summaryrefslogtreecommitdiff
path: root/scene/2d/ray_cast_2d.h
diff options
context:
space:
mode:
authorPaul Joannon <hello@pauljoannon.com>2022-08-14 10:09:35 +0200
committerPaul Joannon <hello@pauljoannon.com>2022-08-22 09:18:08 +0200
commit6bc0be16a54862af2f75c8ed12109c079349ad17 (patch)
treed0efc51759e69284ac730fb31d45b657a0776ea2 /scene/2d/ray_cast_2d.h
parent0c5f254956f0115e363ce08045dd178dc30b54f8 (diff)
Expose the collider RID in Raycast nodes
Create and expose the method `get_collider_rid` in `RayCast2D` and `Raycast3D`. This method returns the `RID` of the first object that the ray intersects, or an empty `RID` if no object is intersecting the fay (i.e. `is_colliding` returns `false`).
Diffstat (limited to 'scene/2d/ray_cast_2d.h')
-rw-r--r--scene/2d/ray_cast_2d.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/scene/2d/ray_cast_2d.h b/scene/2d/ray_cast_2d.h
index 1fb97d89fe..57f993fe8d 100644
--- a/scene/2d/ray_cast_2d.h
+++ b/scene/2d/ray_cast_2d.h
@@ -41,6 +41,7 @@ class RayCast2D : public Node2D {
bool enabled = true;
bool collided = false;
ObjectID against;
+ RID against_rid;
int against_shape = 0;
Vector2 collision_point;
Vector2 collision_normal;
@@ -91,6 +92,7 @@ public:
bool is_colliding() const;
Object *get_collider() const;
+ RID get_collider_rid() const;
int get_collider_shape() const;
Vector2 get_collision_point() const;
Vector2 get_collision_normal() const;