Skip to content

class_physics2ddirectbodystate

Lukas Sägesser edited this page Jun 22, 2015 · 12 revisions

Physics2DDirectBodyState

####Inherits: Object ####Category: Core

Brief Description

Direct access object to a physics body in the Physics2DServer.

Member Functions

Description

Direct access object to a physics body in the Physics2DServer. This object is passed via the direct state callback of rigid/character bodies, and is intended for changing the direct state of that body.

Member Function Description

  • Vector2 get_total_gravity ( ) const

Return the total gravity vector being currently applied to this body.

  • float get_inverse_mass ( ) const

Return the inverse of the mass of the body.

  • float get_inverse_inertia ( ) const

Return the inverse of the inertia of the body.

  • void set_linear_velocity ( Vector2 velocity )

Change the linear velocity of the body.

  • Vector2 get_linear_velocity ( ) const

Return the current linear velocity of the body.

  • void set_angular_velocity ( float velocity )

Change the angular velocity of the body.

  • float get_angular_velocity ( ) const

Return the angular velocity of the body.

  • void set_transform ( Matrix32 transform )

Change the transform matrix of the body.

Return the transform matrix of the body.

  • void set_sleep_state ( bool enabled )

Set the sleeping state of the body, only affects character/rigid bodies.

  • bool is_sleeping ( ) const

Return true if this body is currently sleeping (not active).

  • int get_contact_count ( ) const

Return the amount of contacts this body has with other bodies. Note that by default this returns 0 unless bodies are configured to log contacts.

  • Vector2 get_contact_local_pos ( int contact_idx ) const

Return the local position (of this body) of the contact point.

  • int get_contact_local_shape ( int contact_idx ) const

Return the local shape index of the collision.

  • RID get_contact_collider ( int contact_idx ) const

Return the RID of the collider.

  • Vector2 get_contact_collider_pos ( int contact_idx ) const

Return the contact position in the collider.

  • int get_contact_collider_id ( int contact_idx ) const

Return the object id of the collider.

  • Object get_contact_collider_object ( int contact_idx ) const

Return the collider object, this depends on how it was created (will return a scene node if such was used to create it).

  • int get_contact_collider_shape ( int contact_idx ) const

Return the collider shape index.

  • Vector2 get_contact_collider_velocity_at_pos ( int contact_idx ) const

Return the linear velocity vector at contact point of the collider.

  • float get_step ( ) const

Return the timestep (delta) used for the simulation.

  • void integrate_forces ( )

Call the built-in force integration code.

Return the current state of space, useful for queries.

Clone this wiki locally