mirror of
https://github.com/godotengine/godot.git
synced 2024-12-03 09:52:18 +08:00
81064cc239
We don't use that info for anything, and it generates unnecessary diffs every time we bump the minor version (and CI failures if we forget to sync some files from opt-in modules (mono, text_server_fb).
84 lines
5.5 KiB
XML
84 lines
5.5 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<class name="Shape2D" inherits="Resource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
|
|
<brief_description>
|
|
Abstract base class for 2D shapes used for physics collision.
|
|
</brief_description>
|
|
<description>
|
|
Abstract base class for all 2D shapes, intended for use in physics.
|
|
[b]Performance:[/b] Primitive shapes, especially [CircleShape2D], are fast to check collisions against. [ConvexPolygonShape2D] is slower, and [ConcavePolygonShape2D] is the slowest.
|
|
</description>
|
|
<tutorials>
|
|
<link title="Physics introduction">$DOCS_URL/tutorials/physics/physics_introduction.html</link>
|
|
</tutorials>
|
|
<methods>
|
|
<method name="collide">
|
|
<return type="bool" />
|
|
<param index="0" name="local_xform" type="Transform2D" />
|
|
<param index="1" name="with_shape" type="Shape2D" />
|
|
<param index="2" name="shape_xform" type="Transform2D" />
|
|
<description>
|
|
Returns [code]true[/code] if this shape is colliding with another.
|
|
This method needs the transformation matrix for this shape ([param local_xform]), the shape to check collisions with ([param with_shape]), and the transformation matrix of that shape ([param shape_xform]).
|
|
</description>
|
|
</method>
|
|
<method name="collide_and_get_contacts">
|
|
<return type="PackedVector2Array" />
|
|
<param index="0" name="local_xform" type="Transform2D" />
|
|
<param index="1" name="with_shape" type="Shape2D" />
|
|
<param index="2" name="shape_xform" type="Transform2D" />
|
|
<description>
|
|
Returns a list of contact point pairs where this shape touches another.
|
|
If there are no collisions, the returned list is empty. Otherwise, the returned list contains contact points arranged in pairs, with entries alternating between points on the boundary of this shape and points on the boundary of [param with_shape].
|
|
A collision pair A, B can be used to calculate the collision normal with [code](B - A).normalized()[/code], and the collision depth with [code](B - A).length()[/code]. This information is typically used to separate shapes, particularly in collision solvers.
|
|
This method needs the transformation matrix for this shape ([param local_xform]), the shape to check collisions with ([param with_shape]), and the transformation matrix of that shape ([param shape_xform]).
|
|
</description>
|
|
</method>
|
|
<method name="collide_with_motion">
|
|
<return type="bool" />
|
|
<param index="0" name="local_xform" type="Transform2D" />
|
|
<param index="1" name="local_motion" type="Vector2" />
|
|
<param index="2" name="with_shape" type="Shape2D" />
|
|
<param index="3" name="shape_xform" type="Transform2D" />
|
|
<param index="4" name="shape_motion" type="Vector2" />
|
|
<description>
|
|
Returns whether this shape would collide with another, if a given movement was applied.
|
|
This method needs the transformation matrix for this shape ([param local_xform]), the movement to test on this shape ([param local_motion]), the shape to check collisions with ([param with_shape]), the transformation matrix of that shape ([param shape_xform]), and the movement to test onto the other object ([param shape_motion]).
|
|
</description>
|
|
</method>
|
|
<method name="collide_with_motion_and_get_contacts">
|
|
<return type="PackedVector2Array" />
|
|
<param index="0" name="local_xform" type="Transform2D" />
|
|
<param index="1" name="local_motion" type="Vector2" />
|
|
<param index="2" name="with_shape" type="Shape2D" />
|
|
<param index="3" name="shape_xform" type="Transform2D" />
|
|
<param index="4" name="shape_motion" type="Vector2" />
|
|
<description>
|
|
Returns a list of contact point pairs where this shape would touch another, if a given movement was applied.
|
|
If there would be no collisions, the returned list is empty. Otherwise, the returned list contains contact points arranged in pairs, with entries alternating between points on the boundary of this shape and points on the boundary of [param with_shape].
|
|
A collision pair A, B can be used to calculate the collision normal with [code](B - A).normalized()[/code], and the collision depth with [code](B - A).length()[/code]. This information is typically used to separate shapes, particularly in collision solvers.
|
|
This method needs the transformation matrix for this shape ([param local_xform]), the movement to test on this shape ([param local_motion]), the shape to check collisions with ([param with_shape]), the transformation matrix of that shape ([param shape_xform]), and the movement to test onto the other object ([param shape_motion]).
|
|
</description>
|
|
</method>
|
|
<method name="draw">
|
|
<return type="void" />
|
|
<param index="0" name="canvas_item" type="RID" />
|
|
<param index="1" name="color" type="Color" />
|
|
<description>
|
|
Draws a solid shape onto a [CanvasItem] with the [RenderingServer] API filled with the specified [param color]. The exact drawing method is specific for each shape and cannot be configured.
|
|
</description>
|
|
</method>
|
|
<method name="get_rect" qualifiers="const">
|
|
<return type="Rect2" />
|
|
<description>
|
|
Returns a [Rect2] representing the shapes boundary.
|
|
</description>
|
|
</method>
|
|
</methods>
|
|
<members>
|
|
<member name="custom_solver_bias" type="float" setter="set_custom_solver_bias" getter="get_custom_solver_bias" default="0.0">
|
|
The shape's custom solver bias. Defines how much bodies react to enforce contact separation when this shape is involved.
|
|
When set to [code]0[/code], the default value from [member ProjectSettings.physics/2d/solver/default_contact_bias] is used.
|
|
</member>
|
|
</members>
|
|
</class>
|