Physics2DDirectBodyState

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.

@GodotBaseClass
struct Physics2DDirectBodyState {}

Members

Aliases

BaseClasses
alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses)
Undocumented in source.

Functions

addCentralForce
void addCentralForce(Vector2 force)
addForce
void addForce(Vector2 offset, Vector2 force)
addTorque
void addTorque(double torque)
applyCentralImpulse
void applyCentralImpulse(Vector2 impulse)
applyImpulse
void applyImpulse(Vector2 offset, Vector2 impulse)
applyTorqueImpulse
void applyTorqueImpulse(double impulse)
getAngularVelocity
double getAngularVelocity()
getContactCollider
RID getContactCollider(long contact_idx)

Return the RID of the collider.

getContactColliderId
long getContactColliderId(long contact_idx)

Return the object id of the collider.

getContactColliderObject
GodotObject getContactColliderObject(long contact_idx)

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

getContactColliderPosition
Vector2 getContactColliderPosition(long contact_idx)

Return the contact position in the collider.

getContactColliderShape
long getContactColliderShape(long contact_idx)

Return the collider shape index.

getContactColliderShapeMetadata
Variant getContactColliderShapeMetadata(long contact_idx)

Return the metadata of the collided shape. This metadata is different from GodotObject.getMeta, and is set with Physics2DServer.shapeSetData.

getContactColliderVelocityAtPosition
Vector2 getContactColliderVelocityAtPosition(long contact_idx)

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

getContactCount
long getContactCount()

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.

getContactLocalNormal
Vector2 getContactLocalNormal(long contact_idx)

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

getContactLocalPosition
Vector2 getContactLocalPosition(long contact_idx)

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

getContactLocalShape
long getContactLocalShape(long contact_idx)

Return the local shape index of the collision.

getInverseInertia
double getInverseInertia()
getInverseMass
double getInverseMass()
getLinearVelocity
Vector2 getLinearVelocity()
getSpaceState
Physics2DDirectSpaceState getSpaceState()

Return the current state of space, useful for queries.

getStep
double getStep()
getTotalAngularDamp
double getTotalAngularDamp()
getTotalGravity
Vector2 getTotalGravity()
getTotalLinearDamp
double getTotalLinearDamp()
getTransform
Transform2D getTransform()
integrateForces
void integrateForces()

Call the built-in force integration code.

isSleeping
bool isSleeping()
opAssign
Physics2DDirectBodyState opAssign(T n)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(Physics2DDirectBodyState other)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(typeof(null) n)
Undocumented in source. Be warned that the author may not have intended to support it.
setAngularVelocity
void setAngularVelocity(double velocity)
setLinearVelocity
void setLinearVelocity(Vector2 velocity)
setSleepState
void setSleepState(bool enabled)
setTransform
void setTransform(Transform2D transform)

Mixins

__anonymous
mixin baseCasts
Undocumented in source.

Properties

angularVelocity
double angularVelocity [@property getter]
double angularVelocity [@property setter]

The angular velocity of the body.

inverseInertia
double inverseInertia [@property getter]

The inverse of the inertia of the body.

inverseMass
double inverseMass [@property getter]

The inverse of the mass of the body.

linearVelocity
Vector2 linearVelocity [@property getter]
Vector2 linearVelocity [@property setter]

The linear velocity of the body.

sleeping
bool sleeping [@property getter]
bool sleeping [@property setter]

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

step
double step [@property getter]

The timestep (delta) used for the simulation.

totalAngularDamp
double totalAngularDamp [@property getter]

The rate at which the body stops rotating, if there are not any other forces moving it.

totalGravity
Vector2 totalGravity [@property getter]

The total gravity vector being currently applied to this body.

totalLinearDamp
double totalLinearDamp [@property getter]

The rate at which the body stops moving, if there are not any other forces moving it.

transform
Transform2D transform [@property getter]
Transform2D transform [@property setter]

The transformation matrix of the body.

Static functions

_new
Physics2DDirectBodyState _new()
Undocumented in source. Be warned that the author may not have intended to support it.

Static variables

_classBindingInitialized
bool _classBindingInitialized;
Undocumented in source.

Structs

_classBinding
struct _classBinding
Undocumented in source.

Unions

__anonymous
union __anonymous
Undocumented in source.

Variables

_GODOT_internal_name
enum string _GODOT_internal_name;
Undocumented in source.

Mixed In Members

From mixin baseCasts

as
To as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
To as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
ToRef as()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(ToRef)
Undocumented in source.
opCast
void* opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
godot_object opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
bool opCast()
Undocumented in source. Be warned that the author may not have intended to support it.

Meta