Add instructions to get shape of `RayCast2D/3D`
Adds details on how to get the intersected shape
(cherry picked from commit f2d4ff5c1f
)
This commit is contained in:
parent
30eb46b938
commit
e1826e7caf
|
@ -56,6 +56,21 @@
|
||||||
<return type="int" />
|
<return type="int" />
|
||||||
<description>
|
<description>
|
||||||
Returns the shape ID of the first object that the ray intersects, or [code]0[/code] if no object is intersecting the ray (i.e. [method is_colliding] returns [code]false[/code]).
|
Returns the shape ID of the first object that the ray intersects, or [code]0[/code] if no object is intersecting the ray (i.e. [method is_colliding] returns [code]false[/code]).
|
||||||
|
To get the intersected shape node, for a [CollisionObject2D] target, use:
|
||||||
|
[codeblocks]
|
||||||
|
[gdscript]
|
||||||
|
var target = get_collider() # A CollisionObject2D.
|
||||||
|
var shape_id = get_collider_shape() # The shape index in the collider.
|
||||||
|
var owner_id = target.shape_find_owner(shape_id) # The owner ID in the collider.
|
||||||
|
var shape = target.shape_owner_get_owner(owner_id)
|
||||||
|
[/gdscript]
|
||||||
|
[csharp]
|
||||||
|
var target = (CollisionObject2D)GetCollider(); // A CollisionObject2D.
|
||||||
|
var shapeId = GetColliderShape(); // The shape index in the collider.
|
||||||
|
var ownerId = target.ShapeFindOwner(shapeId); // The owner ID in the collider.
|
||||||
|
var shape = target.ShapeOwnerGetOwner(ownerId);
|
||||||
|
[/csharp]
|
||||||
|
[/codeblocks]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="get_collision_mask_value" qualifiers="const">
|
<method name="get_collision_mask_value" qualifiers="const">
|
||||||
|
|
|
@ -57,6 +57,21 @@
|
||||||
<return type="int" />
|
<return type="int" />
|
||||||
<description>
|
<description>
|
||||||
Returns the shape ID of the first object that the ray intersects, or [code]0[/code] if no object is intersecting the ray (i.e. [method is_colliding] returns [code]false[/code]).
|
Returns the shape ID of the first object that the ray intersects, or [code]0[/code] if no object is intersecting the ray (i.e. [method is_colliding] returns [code]false[/code]).
|
||||||
|
To get the intersected shape node, for a [CollisionObject3D] target, use:
|
||||||
|
[codeblocks]
|
||||||
|
[gdscript]
|
||||||
|
var target = get_collider() # A CollisionObject3D.
|
||||||
|
var shape_id = get_collider_shape() # The shape index in the collider.
|
||||||
|
var owner_id = target.shape_find_owner(shape_id) # The owner ID in the collider.
|
||||||
|
var shape = target.shape_owner_get_owner(owner_id)
|
||||||
|
[/gdscript]
|
||||||
|
[csharp]
|
||||||
|
var target = (CollisionObject3D)GetCollider(); // A CollisionObject3D.
|
||||||
|
var shapeId = GetColliderShape(); // The shape index in the collider.
|
||||||
|
var ownerId = target.ShapeFindOwner(shapeId); // The owner ID in the collider.
|
||||||
|
var shape = target.ShapeOwnerGetOwner(ownerId);
|
||||||
|
[/csharp]
|
||||||
|
[/codeblocks]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="get_collision_mask_value" qualifiers="const">
|
<method name="get_collision_mask_value" qualifiers="const">
|
||||||
|
|
Loading…
Reference in New Issue