mirror of
https://github.com/godotengine/godot.git
synced 2024-11-27 09:16:35 +08:00
Partial documentation for Polygon2D and Raycast2D (#4467)
This commit is contained in:
parent
8156f4944e
commit
9f29b4b26a
@ -27184,80 +27184,94 @@ This method controls whether the position between two cached points is interpola
|
||||
</class>
|
||||
<class name="Polygon2D" inherits="Node2D" category="Core">
|
||||
<brief_description>
|
||||
2D polygon representation
|
||||
</brief_description>
|
||||
<description>
|
||||
A Polygon2D is defined by a set of n points connected together by line segments, meaning that the point 1 will be connected with point 2, point 2 with point 3 ..., point n-1 with point n and point n with point 1 in order to close the loop and define a plane.
|
||||
</description>
|
||||
<methods>
|
||||
<method name="set_polygon">
|
||||
<argument index="0" name="polygon" type="Vector2Array">
|
||||
</argument>
|
||||
<description>
|
||||
Defines the set of points that will represent the polygon.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_polygon" qualifiers="const">
|
||||
<return type="Vector2Array">
|
||||
</return>
|
||||
<description>
|
||||
Returns the set of points that defines this polygon
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_uv">
|
||||
<argument index="0" name="uv" type="Vector2Array">
|
||||
</argument>
|
||||
<description>
|
||||
Sets the uv value for every point of the polygon
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_uv" qualifiers="const">
|
||||
<return type="Vector2Array">
|
||||
</return>
|
||||
<description>
|
||||
Returns the uv value associated with every point of the polygon
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_color">
|
||||
<argument index="0" name="color" type="Color">
|
||||
</argument>
|
||||
<description>
|
||||
Sets the polygon fill color, if the polygon has a texture defined, the defined texture will be tinted to the polygon fill color.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_color" qualifiers="const">
|
||||
<return type="Color">
|
||||
</return>
|
||||
<description>
|
||||
Returns the polygon fill color
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_texture">
|
||||
<argument index="0" name="texture" type="Object">
|
||||
</argument>
|
||||
<description>
|
||||
Sets the polygon texture.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_texture" qualifiers="const">
|
||||
<return type="Object">
|
||||
</return>
|
||||
<description>
|
||||
Returns the polygon texture
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_texture_offset">
|
||||
<argument index="0" name="texture_offset" type="Vector2">
|
||||
</argument>
|
||||
<description>
|
||||
Sets the offset of the polygon texture. Initially the texture will appear anchored to the polygon position, the offset is used to move the texture location away from that point (notice that the texture origin is set to its top left corner, so when offset is 0,0 the top left corner of the texture is at the polygon position), for example setting the offset to 10, 10 will move the texture 10 units to the left and 10 units to the top.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_texture_offset" qualifiers="const">
|
||||
<return type="Vector2">
|
||||
</return>
|
||||
<description>
|
||||
Returns the polygon texture offset
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_texture_rotation">
|
||||
<argument index="0" name="texture_rotation" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Sets the amount of rotation of the polygon texture, [code]texture_rotation[/code] is specified in degrees and clockwise rotation, meaning that if the texture rotation is set to 45 degrees, the texture will be rotated 45 degrees clockwise along the polygon position plus the texture offset.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_texture_rotation" qualifiers="const">
|
||||
<return type="float">
|
||||
</return>
|
||||
<description>
|
||||
Returns the rotation in degrees of the texture polygon
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_texture_scale">
|
||||
@ -27276,12 +27290,14 @@ This method controls whether the position between two cached points is interpola
|
||||
<argument index="0" name="invert" type="bool">
|
||||
</argument>
|
||||
<description>
|
||||
Sets the polygon as the defined polygon bounding box minus the defined polygon (the defined polygon will appear as a hole on square that contains the defined polygon).
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_invert" qualifiers="const">
|
||||
<return type="bool">
|
||||
</return>
|
||||
<description>
|
||||
Returns whether this polygon is inverted or not
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_invert_border">
|
||||
@ -27300,12 +27316,14 @@ This method controls whether the position between two cached points is interpola
|
||||
<argument index="0" name="offset" type="Vector2">
|
||||
</argument>
|
||||
<description>
|
||||
Sets the amount of distance from the polygon points from the polygon position, for example if the offset is set to 10,10 then all the polygon points will move 10 units to the right and 10 units to the bottom.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_offset" qualifiers="const">
|
||||
<return type="Vector2">
|
||||
</return>
|
||||
<description>
|
||||
Returns the polygon points offset to the polygon position.
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
@ -28531,39 +28549,45 @@ This method controls whether the position between two cached points is interpola
|
||||
</class>
|
||||
<class name="RayCast2D" inherits="Node2D" category="Core">
|
||||
<brief_description>
|
||||
Query the closest object intersecting a ray
|
||||
</brief_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.
|
||||
</description>
|
||||
<methods>
|
||||
<method name="set_enabled">
|
||||
<argument index="0" name="enabled" type="bool">
|
||||
</argument>
|
||||
<description>
|
||||
Enables the RayCast2D. Only enabled raycasts will be able to query the space and report collisions.
|
||||
</description>
|
||||
</method>
|
||||
<method name="is_enabled" qualifiers="const">
|
||||
<return type="bool">
|
||||
</return>
|
||||
<description>
|
||||
Returns whether this raycast is enabled or not
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_cast_to">
|
||||
<argument index="0" name="local_point" type="Vector2">
|
||||
</argument>
|
||||
<description>
|
||||
Sets the ray destination point, so that the ray will test from the ray's origin to [code]local_point[/code]
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_cast_to" qualifiers="const">
|
||||
<return type="Vector2">
|
||||
</return>
|
||||
<description>
|
||||
Return the destination point of this ray object
|
||||
</description>
|
||||
</method>
|
||||
<method name="is_colliding" qualifiers="const">
|
||||
<return type="bool">
|
||||
</return>
|
||||
<description>
|
||||
Return whether the closest object the ray is pointing to is colliding with the vector, with the vector length considered.
|
||||
Return whether the closest object the ray is pointing to is colliding with the vector (considering the vector length).
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_collider" qualifiers="const">
|
||||
@ -28577,18 +28601,21 @@ This method controls whether the position between two cached points is interpola
|
||||
<return type="int">
|
||||
</return>
|
||||
<description>
|
||||
Returns the collision shape of the closest object the ray is pointing to.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_collision_point" qualifiers="const">
|
||||
<return type="Vector2">
|
||||
</return>
|
||||
<description>
|
||||
Returns the collision point in which the ray intersects the closest object.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_collision_normal" qualifiers="const">
|
||||
<return type="Vector2">
|
||||
</return>
|
||||
<description>
|
||||
Returns the normal of the intersecting object shape face containing the collision point.
|
||||
</description>
|
||||
</method>
|
||||
<method name="add_exception_rid">
|
||||
@ -28601,6 +28628,7 @@ This method controls whether the position between two cached points is interpola
|
||||
<argument index="0" name="node" type="Object">
|
||||
</argument>
|
||||
<description>
|
||||
Adds a collision exception so the ray does not report collisions with the specified [code]node[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="remove_exception_rid">
|
||||
@ -28613,10 +28641,12 @@ This method controls whether the position between two cached points is interpola
|
||||
<argument index="0" name="node" type="Object">
|
||||
</argument>
|
||||
<description>
|
||||
Removes a collision exception so the ray does report collisions with the specified [code]node[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="clear_exceptions">
|
||||
<description>
|
||||
Removes all collision exception for this ray.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_layer_mask">
|
||||
@ -28629,6 +28659,7 @@ This method controls whether the position between two cached points is interpola
|
||||
<return type="int">
|
||||
</return>
|
||||
<description>
|
||||
Returns the layer mask for this ray.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_type_mask">
|
||||
|
Loading…
Reference in New Issue
Block a user