Browse Source

Filled blanks and normalized documentation on RayCast[2D]

(cherry picked from commit db0a46d7f7af220cede52198f05082f74ca9c546)
Karol Walasek 9 years ago
parent
commit
b2a58da321
1 changed files with 31 additions and 4 deletions
  1. 31 4
      doc/base/classes.xml

+ 31 - 4
doc/base/classes.xml

@@ -30815,14 +30815,21 @@
 </class>
 </class>
 <class name="RayCast" inherits="Spatial" category="Core">
 <class name="RayCast" inherits="Spatial" category="Core">
 	<brief_description>
 	<brief_description>
+		Query the closest object intersecting a ray.
 	</brief_description>
 	</brief_description>
 	<description>
 	<description>
+		A RayCast represents a line from its origin to its destination position [code]cast_to[/code], it is used to query the 3D space in order to find the closest object intersecting with the ray.
+
+		RayCast can ignore some objects by adding them to the exception list via [code]add_exception[/code], setting proper filtering with layers, or by filtering object types with type masks.
+
+		Only enabled raycasts will be able to query the space and report collisions!
 	</description>
 	</description>
 	<methods>
 	<methods>
 		<method name="add_exception">
 		<method name="add_exception">
 			<argument index="0" name="node" type="Object">
 			<argument index="0" name="node" type="Object">
 			</argument>
 			</argument>
 			<description>
 			<description>
+				Adds a collision exception so the ray does not report collisions with the specified [code]node[/code].
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="add_exception_rid">
 		<method name="add_exception_rid">
@@ -30833,30 +30840,35 @@
 		</method>
 		</method>
 		<method name="clear_exceptions">
 		<method name="clear_exceptions">
 			<description>
 			<description>
+				Removes all collision exception for this ray.
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="get_cast_to" qualifiers="const">
 		<method name="get_cast_to" qualifiers="const">
 			<return type="Vector3">
 			<return type="Vector3">
 			</return>
 			</return>
 			<description>
 			<description>
+				Return the destination point of this ray object.
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="get_collider" qualifiers="const">
 		<method name="get_collider" qualifiers="const">
 			<return type="Object">
 			<return type="Object">
 			</return>
 			</return>
 			<description>
 			<description>
+				Return the closest object the ray is pointing to. Note that this does not consider the length of the vector, so you must also use [method is_colliding] to check if the object returned is actually colliding with the ray.
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="get_collider_shape" qualifiers="const">
 		<method name="get_collider_shape" qualifiers="const">
 			<return type="int">
 			<return type="int">
 			</return>
 			</return>
 			<description>
 			<description>
+				Returns the collision shape of the closest object the ray is pointing to.
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="get_collision_normal" qualifiers="const">
 		<method name="get_collision_normal" qualifiers="const">
 			<return type="Vector3">
 			<return type="Vector3">
 			</return>
 			</return>
 			<description>
 			<description>
+				Returns the normal of the intersecting object shape face containing the collision point.
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="get_collision_point" qualifiers="const">
 		<method name="get_collision_point" qualifiers="const">
@@ -30870,30 +30882,35 @@
 			<return type="int">
 			<return type="int">
 			</return>
 			</return>
 			<description>
 			<description>
+				Returns the layer mask for this ray.
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="get_type_mask" qualifiers="const">
 		<method name="get_type_mask" qualifiers="const">
 			<return type="int">
 			<return type="int">
 			</return>
 			</return>
 			<description>
 			<description>
+				Returns the type mask (types of objects to detect) for this ray. The value is a sum (bitwise OR'd) of constants available for [PhysicsDirectSpaceState].
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="is_colliding" qualifiers="const">
 		<method name="is_colliding" qualifiers="const">
 			<return type="bool">
 			<return type="bool">
 			</return>
 			</return>
 			<description>
 			<description>
+				Return whether the closest object the ray is pointing to is colliding with the vector (considering the vector length).
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="is_enabled" qualifiers="const">
 		<method name="is_enabled" qualifiers="const">
 			<return type="bool">
 			<return type="bool">
 			</return>
 			</return>
 			<description>
 			<description>
+				Returns whether this raycast is enabled or not.
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="remove_exception">
 		<method name="remove_exception">
 			<argument index="0" name="node" type="Object">
 			<argument index="0" name="node" type="Object">
 			</argument>
 			</argument>
 			<description>
 			<description>
+				Removes a collision exception so the ray does report collisions with the specified [code]node[/code].
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="remove_exception_rid">
 		<method name="remove_exception_rid">
@@ -30913,18 +30930,21 @@
 			<argument index="0" name="enabled" type="bool">
 			<argument index="0" name="enabled" type="bool">
 			</argument>
 			</argument>
 			<description>
 			<description>
+				Enables the RayCast2D. Only enabled raycasts will be able to query the space and report collisions.
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="set_layer_mask">
 		<method name="set_layer_mask">
 			<argument index="0" name="mask" type="int">
 			<argument index="0" name="mask" type="int">
 			</argument>
 			</argument>
 			<description>
 			<description>
+				Set the mask to filter objects. Only objects with at least the same mask element set will be detected.
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="set_type_mask">
 		<method name="set_type_mask">
 			<argument index="0" name="mask" type="int">
 			<argument index="0" name="mask" type="int">
 			</argument>
 			</argument>
 			<description>
 			<description>
+				Set the types of objects to detect. For [code]mask[/code] use a logic sum (OR operation) of constants defined in [PhysicsDirectSpaceState], eg. [code]PhysicsDirectSpaceState.TYPE_MASK_STATIC_BODY | PhysicsDirectSpaceState.TYPE_MASK_KINEMATIC_BODY[/code] to detect only those two types.
 			</description>
 			</description>
 		</method>
 		</method>
 	</methods>
 	</methods>
@@ -30933,10 +30953,14 @@
 </class>
 </class>
 <class name="RayCast2D" inherits="Node2D" category="Core">
 <class name="RayCast2D" inherits="Node2D" category="Core">
 	<brief_description>
 	<brief_description>
-		Query the closest object intersecting a ray
+		Query the closest object intersecting a ray.
 	</brief_description>
 	</brief_description>
 	<description>
 	<description>
 		A RayCast2D represents a line from its origin to its destination position [code]cast_to[/code], it is used to query the 2D space in order to find the closest object intersecting with the ray.
 		A RayCast2D represents a line from its origin to its destination position [code]cast_to[/code], it is used to query the 2D space in order to find the closest object intersecting with the ray.
+
+		RayCast2D can ignore some objects by adding them to the exception list via [code]add_exception[/code], setting proper filtering with layers, or by filtering object types with type masks.
+
+		Only enabled raycasts will be able to query the space and report collisions!
 	</description>
 	</description>
 	<methods>
 	<methods>
 		<method name="add_exception">
 		<method name="add_exception">
@@ -30961,7 +30985,7 @@
 			<return type="Vector2">
 			<return type="Vector2">
 			</return>
 			</return>
 			<description>
 			<description>
-				Return the destination point of this ray object
+				Return the destination point of this ray object.
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="get_collider" qualifiers="const">
 		<method name="get_collider" qualifiers="const">
@@ -30989,7 +31013,7 @@
 			<return type="Vector2">
 			<return type="Vector2">
 			</return>
 			</return>
 			<description>
 			<description>
-				Returns the collision point in which the ray intersects the closest object.
+				Returns the collision point in which the ray intersects the closest object. This point is in [b]global[/b] coordinate system.
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="get_layer_mask" qualifiers="const">
 		<method name="get_layer_mask" qualifiers="const">
@@ -31003,6 +31027,7 @@
 			<return type="int">
 			<return type="int">
 			</return>
 			</return>
 			<description>
 			<description>
+				Returns the type mask (types of objects to detect) for this ray. The value is a sum (bitwise OR'd) of constants available for [Physics2DDirectSpaceState].
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="is_colliding" qualifiers="const">
 		<method name="is_colliding" qualifiers="const">
@@ -31016,7 +31041,7 @@
 			<return type="bool">
 			<return type="bool">
 			</return>
 			</return>
 			<description>
 			<description>
-				Returns whether this raycast is enabled or not
+				Returns whether this raycast is enabled or not.
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="remove_exception">
 		<method name="remove_exception">
@@ -31050,12 +31075,14 @@
 			<argument index="0" name="mask" type="int">
 			<argument index="0" name="mask" type="int">
 			</argument>
 			</argument>
 			<description>
 			<description>
+				Set the mask to filter objects. Only objects with at least the same mask element set will be detected.
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="set_type_mask">
 		<method name="set_type_mask">
 			<argument index="0" name="mask" type="int">
 			<argument index="0" name="mask" type="int">
 			</argument>
 			</argument>
 			<description>
 			<description>
+				Set the types of objects to detect. For [code]mask[/code] use a logic sum (OR operation) of constants defined in [Physics2DDirectSpaceState], eg. [code]Physics2DDirectSpaceState.TYPE_MASK_STATIC_BODY | Physics2DDirectSpaceState.TYPE_MASK_KINEMATIC_BODY[/code] to detect only those two types.
 			</description>
 			</description>
 		</method>
 		</method>
 	</methods>
 	</methods>