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.
Checking the stable version of the documentation...
PhysicsIntersectRayResult2D
Inherits: RefCounted < Object
Stores the result of a ray intersection query.
Description
This object contains the intersection information produced by PhysicsDirectSpaceState2D.intersect_ray_into().
After calling PhysicsDirectSpaceState2D.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
|
||
|
||
|
||
|
||
|
Property Descriptions
Object get_collider()
The colliding object.
int get_collider_id()
The colliding object's ID.
RID get_collider_rid()
The intersecting object's RID.
int get_collider_shape()
The shape index of the colliding shape.
Vector2 normal = Vector2(0, 0) 🔗
Vector2 get_normal()
The object's surface normal at the intersection point, or Vector2(0, 0) if the ray starts inside the shape and PhysicsRayQueryParameters2D.hit_from_inside is true.
Vector2 position = Vector2(0, 0) 🔗
Vector2 get_position()
The intersection point.