Skip to content

PhysicsIntersectRayResult3D

Inherits: RefCounted < Object

Stores the result of a ray intersection query.

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.

Type Name Default
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)

collider

Object collider

The colliding object.

collider_face_index

int collider_face_index = -1

The face index at the intersection point.

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

collider_id

int collider_id = 0

The colliding object’s ID.

collider_rid

RID collider_rid = RID()

The intersecting object’s RID.

collider_shape

int collider_shape = 0

The shape index of the colliding shape.

normal

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.

position

Vector3 position = Vector3(0, 0, 0)

The intersection point.