Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

PhysicsIntersectRayResult3D

Inherits: RefCounted < Object

Stores the result of a ray intersection query.

Description

This object contains the intersection information produced by PhysicsDirectSpaceState3D.intersect_ray_into().

After calling PhysicsDirectSpaceState3D.intersect_ray_into(), the fields of this object will be populated with the hit information if the ray intersects a shape. If no intersection occurred, the values remain unchanged from the previous state.

Note: For optimal performance results, it is recommended to create this object in advance, store it, and reuse it for every subsequent query.

Properties

Object

collider

int

collider_face_index

-1

int

collider_id

0

RID

collider_rid

RID()

int

collider_shape

0

Vector3

normal

Vector3(0, 0, 0)

Vector3

position

Vector3(0, 0, 0)


Property Descriptions

Object collider 🔗

The colliding object.


int collider_face_index = -1 🔗

  • int get_collider_face_index()

The face index at the intersection point.

Note: Returns a valid number only if the intersected shape is a ConcavePolygonShape3D. Otherwise, -1 is returned.


int collider_id = 0 🔗

  • int get_collider_id()

The colliding object's ID.


RID collider_rid = RID() 🔗

  • RID get_collider_rid()

The intersecting object's RID.


int collider_shape = 0 🔗

  • int get_collider_shape()

The shape index of the colliding shape.


Vector3 normal = Vector3(0, 0, 0) 🔗

The object's surface normal at the intersection point, or Vector3(0, 0, 0) if the ray starts inside the shape and PhysicsRayQueryParameters3D.hit_from_inside is true.


Vector3 position = Vector3(0, 0, 0) 🔗

The intersection point.


User-contributed notes

Please read the User-contributed notes policy before submitting a comment.