Shape2D¶
Inherits: Resource < Reference < Object
Inherited By: CapsuleShape2D, CircleShape2D, ConcavePolygonShape2D, ConvexPolygonShape2D, LineShape2D, RayShape2D, RectangleShape2D, SegmentShape2D
Base class for all 2D shapes.
Description¶
Base class for all 2D shapes. All 2D shape types inherit from this.
Tutorials¶
Properties¶
|
Methods¶
collide ( Transform2D local_xform, Shape2D with_shape, Transform2D shape_xform ) |
|
collide_and_get_contacts ( Transform2D local_xform, Shape2D with_shape, Transform2D shape_xform ) |
|
collide_with_motion ( Transform2D local_xform, Vector2 local_motion, Shape2D with_shape, Transform2D shape_xform, Vector2 shape_motion ) |
|
collide_with_motion_and_get_contacts ( Transform2D local_xform, Vector2 local_motion, Shape2D with_shape, Transform2D shape_xform, Vector2 shape_motion ) |
|
void |
Property Descriptions¶
float custom_solver_bias
Default |
|
Setter |
set_custom_solver_bias(value) |
Getter |
get_custom_solver_bias() |
The shape's custom solver bias.
Method Descriptions¶
bool collide ( Transform2D local_xform, Shape2D with_shape, Transform2D shape_xform )
Returns true
if this shape is colliding with another.
This method needs the transformation matrix for this shape (local_xform
), the shape to check collisions with (with_shape
), and the transformation matrix of that shape (shape_xform
).
Array collide_and_get_contacts ( Transform2D local_xform, Shape2D with_shape, Transform2D shape_xform )
Returns a list of the points where this shape touches another. If there are no collisions the list is empty.
This method needs the transformation matrix for this shape (local_xform
), the shape to check collisions with (with_shape
), and the transformation matrix of that shape (shape_xform
).
bool collide_with_motion ( Transform2D local_xform, Vector2 local_motion, Shape2D with_shape, Transform2D shape_xform, Vector2 shape_motion )
Returns whether this shape would collide with another, if a given movement was applied.
This method needs the transformation matrix for this shape (local_xform
), the movement to test on this shape (local_motion
), the shape to check collisions with (with_shape
), the transformation matrix of that shape (shape_xform
), and the movement to test onto the other object (shape_motion
).
Array collide_with_motion_and_get_contacts ( Transform2D local_xform, Vector2 local_motion, Shape2D with_shape, Transform2D shape_xform, Vector2 shape_motion )
Returns a list of the points where this shape would touch another, if a given movement was applied. If there are no collisions the list is empty.
This method needs the transformation matrix for this shape (local_xform
), the movement to test on this shape (local_motion
), the shape to check collisions with (with_shape
), the transformation matrix of that shape (shape_xform
), and the movement to test onto the other object (shape_motion
).
Draws a solid shape onto a CanvasItem with the VisualServer API filled with the specified color
. The exact drawing method is specific for each shape and cannot be configured.