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.

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

Object

collider

int

collider_id

0

RID

collider_rid

RID()

int

collider_shape

0

Vector2

normal

Vector2(0, 0)

Vector2

position

Vector2(0, 0)


Property Descriptions

Object collider 🔗

The colliding object.


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.


Vector2 normal = Vector2(0, 0) 🔗

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) 🔗

The intersection point.


User-contributed notes

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