|
1 | 1 | <?xml version="1.0" encoding="UTF-8" ?> |
2 | 2 | <class name="RayCast2D" inherits="Node2D" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
3 | 3 | <brief_description> |
4 | | - A ray in 2D space, used to find the first [CollisionObject2D] it intersects. |
| 4 | + A ray in 2D space, used to find the first collision object it intersects. |
5 | 5 | </brief_description> |
6 | 6 | <description> |
7 | | - A raycast represents a ray from its origin to its [member target_position] that finds the closest [CollisionObject2D] along its path, if it intersects any. |
| 7 | + A raycast represents a ray from its origin to its [member target_position] that finds the closest object along its path, if it intersects any. |
8 | 8 | [RayCast2D] can ignore some objects by adding them to an exception list, by making its detection reporting ignore [Area2D]s ([member collide_with_areas]) or [PhysicsBody2D]s ([member collide_with_bodies]), or by configuring physics layers. |
9 | 9 | [RayCast2D] calculates intersection every physics frame, and it holds the result until the next physics frame. For an immediate raycast, or if you want to configure a [RayCast2D] multiple times within the same physics frame, use [method force_raycast_update]. |
10 | 10 | To sweep over a region of 2D space, you can approximate the region with multiple [RayCast2D]s or use [ShapeCast2D]. |
|
17 | 17 | <return type="void" /> |
18 | 18 | <param index="0" name="node" type="CollisionObject2D" /> |
19 | 19 | <description> |
20 | | - Adds a collision exception so the ray does not report collisions with the specified [CollisionObject2D] node. |
| 20 | + Adds a collision exception so the ray does not report collisions with the specified [param node]. |
21 | 21 | </description> |
22 | 22 | </method> |
23 | 23 | <method name="add_exception_rid"> |
|
44 | 44 | <return type="Object" /> |
45 | 45 | <description> |
46 | 46 | Returns the first object that the ray intersects, or [code]null[/code] if no object is intersecting the ray (i.e. [method is_colliding] returns [code]false[/code]). |
| 47 | + [b]Note:[/b] This object is not guaranteed to be a [CollisionObject2D]. For example, if the ray intersects a [TileMapLayer], the method will return a [TileMapLayer] instance. |
47 | 48 | </description> |
48 | 49 | </method> |
49 | 50 | <method name="get_collider_rid" qualifiers="const"> |
|
104 | 105 | <return type="void" /> |
105 | 106 | <param index="0" name="node" type="CollisionObject2D" /> |
106 | 107 | <description> |
107 | | - Removes a collision exception so the ray does report collisions with the specified [CollisionObject2D] node. |
| 108 | + Removes a collision exception so the ray can report collisions with the specified specified [param node]. |
108 | 109 | </description> |
109 | 110 | </method> |
110 | 111 | <method name="remove_exception_rid"> |
111 | 112 | <return type="void" /> |
112 | 113 | <param index="0" name="rid" type="RID" /> |
113 | 114 | <description> |
114 | | - Removes a collision exception so the ray does report collisions with the specified [RID]. |
| 115 | + Removes a collision exception so the ray can report collisions with the specified [RID]. |
115 | 116 | </description> |
116 | 117 | </method> |
117 | 118 | <method name="set_collision_mask_value"> |
|
137 | 138 | If [code]true[/code], collisions will be reported. |
138 | 139 | </member> |
139 | 140 | <member name="exclude_parent" type="bool" setter="set_exclude_parent_body" getter="get_exclude_parent_body" default="true"> |
140 | | - If [code]true[/code], the parent node will be excluded from collision detection. |
| 141 | + If [code]true[/code], this raycast will not report collisions with its parent node. This property only has an effect if the parent node is a [CollisionObject2D]. See also [method Node.get_parent] and [method add_exception]. |
141 | 142 | </member> |
142 | 143 | <member name="hit_from_inside" type="bool" setter="set_hit_from_inside" getter="is_hit_from_inside_enabled" default="false"> |
143 | 144 | If [code]true[/code], the ray will detect a hit when starting inside shapes. In this case the collision normal will be [code]Vector2(0, 0)[/code]. Does not affect concave polygon shapes. |
144 | 145 | </member> |
145 | 146 | <member name="target_position" type="Vector2" setter="set_target_position" getter="get_target_position" default="Vector2(0, 50)"> |
146 | | - The ray's destination point, relative to the RayCast's [code]position[/code]. |
| 147 | + The ray's destination point, relative to this raycast's [member Node2D.position]. |
147 | 148 | </member> |
148 | 149 | </members> |
149 | 150 | </class> |
0 commit comments