Shape2D¶
Inherits: Resource < Reference < Object
Inherited By: RayShape2D, CapsuleShape2D, LineShape2D, CircleShape2D, ConcavePolygonShape2D, ConvexPolygonShape2D, RectangleShape2D, SegmentShape2D
Category: Core
Brief Description¶
Base class for all 2D Shapes.
Member Functions¶
bool | collide ( Transform2D local_xform, Shape2D with_shape, Transform2D shape_xform ) |
Variant | collide_and_get_contacts ( Transform2D local_xform, Shape2D with_shape, Transform2D shape_xform ) |
bool | collide_with_motion ( Transform2D local_xform, Vector2 local_motion, Shape2D with_shape, Transform2D shape_xform, Vector2 shape_motion ) |
Variant | collide_with_motion_and_get_contacts ( Transform2D local_xform, Vector2 local_motion, Shape2D with_shape, Transform2D shape_xform, Vector2 shape_motion ) |
float | get_custom_solver_bias ( ) const |
void | set_custom_solver_bias ( float bias ) |
Description¶
Base class for all 2D Shapes. All 2D shape types inherit from this.
Member Function Description¶
- bool collide ( Transform2D local_xform, Shape2D with_shape, Transform2D shape_xform )
Return whether 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
).
- Variant collide_and_get_contacts ( Transform2D local_xform, Shape2D with_shape, Transform2D shape_xform )
Return 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 )
Return 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
).
- Variant collide_with_motion_and_get_contacts ( Transform2D local_xform, Vector2 local_motion, Shape2D with_shape, Transform2D shape_xform, Vector2 shape_motion )
Return 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
).
- float get_custom_solver_bias ( ) const
Return the custom solver bias.
- void set_custom_solver_bias ( float bias )
Use a custom solver bias. No need to change this unless you really know what you are doing.
The solver bias is a factor controlling how much two objects “rebound” off each other, when colliding, to avoid them getting into each other because of numerical imprecision.