PhysicsTestMotionResult2D
Inherits: RefCounted < Object
Description
Section titled “Description”Describes the motion and collision result from PhysicsSystem2D.body_test_motion().
Describes the motion and collision result from PhysicsSystem2D.body_test_motion().
Note: For optimal performance results, it is recommended to create this object in advance, store it, and reuse it for every subsequent query.
Methods
Section titled “Methods”| Returns | Method |
|---|---|
| Object | get_collider() const |
| int | get_collider_id() const |
| RID | get_collider_rid() const |
| int | get_collider_shape() const |
| Vector2 | get_collider_velocity() const |
| float | get_collision_depth() const |
| int | get_collision_local_shape() const |
| Vector2 | get_collision_normal() const |
| Vector2 | get_collision_point() const |
| float | get_collision_safe_fraction() const |
| float | get_collision_unsafe_fraction() const |
| Vector2 | get_remainder() const |
| Vector2 | get_travel() const |
Method descriptions
Section titled “Method descriptions”get_collider
Object get_collider() const
Returns the colliding body’s attached Object, if a collision occurred.
get_collider_id
int get_collider_id() const
Returns the unique instance ID of the colliding body’s attached Object, if a collision occurred. See Object.get_instance_id().
get_collider_rid
RID get_collider_rid() const
Returns the colliding body’s RID used by the PhysicsSystem2D, if a collision occurred.
get_collider_shape
int get_collider_shape() const
Returns the colliding body’s shape index, if a collision occurred. See CollisionObject2D.
get_collider_velocity
Vector2 get_collider_velocity() const
Returns the colliding body’s velocity, if a collision occurred.
get_collision_depth
float get_collision_depth() const
Returns the length of overlap along the collision normal, if a collision occurred.
get_collision_local_shape
int get_collision_local_shape() const
Returns the moving object’s colliding shape, if a collision occurred.
get_collision_normal
Vector2 get_collision_normal() const
Returns the colliding body’s shape’s normal at the point of collision, if a collision occurred.
get_collision_point
Vector2 get_collision_point() const
Returns the point of collision in global coordinates, if a collision occurred.
get_collision_safe_fraction
float get_collision_safe_fraction() const
Returns the maximum fraction of the motion that can occur without a collision, between 0 and 1.
get_collision_unsafe_fraction
float get_collision_unsafe_fraction() const
Returns the minimum fraction of the motion needed to collide, if a collision occurred, between 0 and 1.
get_remainder
Vector2 get_remainder() const
Returns the moving object’s remaining movement vector.
get_travel
Vector2 get_travel() const
Returns the moving object’s travel before collision.
