Skip to content

class_physics2ddirectbodystate

reduz edited this page Feb 23, 2014 · 11 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&#95total&#95gravity ( ) const

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

  • real get&#95total&#95density ( ) const

Return the space density currently being applied to this body.

  • real get&#95inverse&#95mass ( ) const

Return the inverse of the mass of the body.

  • real get&#95inverse&#95inertia ( ) const

Return the inverse of the inertia of the body.

  • void set&#95linear&#95velocity ( Vector2 velocity )

Change the linear velocity of the body.

  • Vector2 get&#95linear&#95velocity ( ) const

Return the current linear velocity of the body.

  • void set&#95angular&#95velocity ( real velocity )

Change the angular velocity of the body.

  • real get&#95angular&#95velocity ( ) const

Return the angular velocity of the body.

  • void set&#95transform ( Matrix32 transform )

Change the transform matrix of the body.

Return the transform matrix of the body.

  • void set&#95sleep&#95state ( bool enabled )

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

  • bool is&#95sleeping ( ) const

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

  • int get&#95contact&#95count ( ) 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&#95contact&#95local&#95pos ( int contact_idx ) const

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

  • int get&#95contact&#95local&#95shape ( int contact_idx ) const

Return the local shape index of the collision.

  • RID get&#95contact&#95collider ( int contact_idx ) const

Return the RID of the collider.

  • Vector2 get&#95contact&#95collider&#95pos ( int contact_idx ) const

Return the contact position in the collider.

  • int get&#95contact&#95collider&#95id ( int contact_idx ) const

Return the object id of the collider.

  • Object get&#95contact&#95collider&#95object ( 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&#95contact&#95collider&#95shape ( int contact_idx ) const

Return the collider shape index.

  • Vector2 get&#95contact&#95collider&#95velocity&#95at&#95pos ( int contact_idx ) const

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

  • real get&#95step ( ) const

Return the timestep (delta) used for the simulation.

  • void integrate&#95forces ( )

Call the built-in force integration code.

Return the current state of space, useful for queries.

Clone this wiki locally