- addCentralForce
void addCentralForce(Vector3 force)
Adds a constant directional force without affecting rotation.
This is equivalent to add_force(force, Vector3(0,0,0)).
- addForce
void addForce(Vector3 force, Vector3 position)
Adds a positioned force to the body. Both the force and the offset from the body origin are in global coordinates.
- addTorque
void addTorque(Vector3 torque)
Adds a constant rotational force without affecting position.
- applyCentralImpulse
void applyCentralImpulse(Vector3 j)
Applies a single directional impulse without affecting rotation.
This is equivalent to apply_impulse(Vector3(0, 0, 0), impulse).
- applyImpulse
void applyImpulse(Vector3 position, Vector3 j)
Applies a positioned impulse to the body. An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason it should only be used when simulating one-time impacts. The position uses the rotation of the global coordinate system, but is centered at the object's origin.
- applyTorqueImpulse
void applyTorqueImpulse(Vector3 j)
Apply a torque impulse (which will be affected by the body mass and shape). This will rotate the body around the vector j passed as parameter.
- getAngularVelocity
Vector3 getAngularVelocity()
- getCenterOfMass
Vector3 getCenterOfMass()
- getContactCollider
RID getContactCollider(long contact_idx)
Returns the collider's RID.
- getContactColliderId
long getContactColliderId(long contact_idx)
Returns the collider's object id.
- getContactColliderObject
GodotObject getContactColliderObject(long contact_idx)
Returns the collider object.
- getContactColliderPosition
Vector3 getContactColliderPosition(long contact_idx)
Returns the contact position in the collider.
- getContactColliderShape
long getContactColliderShape(long contact_idx)
Returns the collider's shape index.
- getContactColliderVelocityAtPosition
Vector3 getContactColliderVelocityAtPosition(long contact_idx)
Returns the linear velocity vector at the collider's contact point.
- getContactCount
long getContactCount()
Returns the number of contacts this body has with other bodies.
Note: By default, this returns 0 unless bodies are configured to monitor contacts. See RigidBody.contactMonitor.
- getContactImpulse
double getContactImpulse(long contact_idx)
Impulse created by the contact. Only implemented for Bullet physics.
- getContactLocalNormal
Vector3 getContactLocalNormal(long contact_idx)
Returns the local normal at the contact point.
- getContactLocalPosition
Vector3 getContactLocalPosition(long contact_idx)
Returns the local position of the contact point.
- getContactLocalShape
long getContactLocalShape(long contact_idx)
Returns the local shape index of the collision.
- getInverseInertia
Vector3 getInverseInertia()
- getInverseMass
double getInverseMass()
- getLinearVelocity
Vector3 getLinearVelocity()
- getPrincipalInertiaAxes
Basis getPrincipalInertiaAxes()
- getSpaceState
PhysicsDirectSpaceState getSpaceState()
Returns the current state of the space, useful for queries.
- getStep
double getStep()
- getTotalAngularDamp
double getTotalAngularDamp()
- getTotalGravity
Vector3 getTotalGravity()
- getTotalLinearDamp
double getTotalLinearDamp()
- getTransform
Transform getTransform()
- integrateForces
void integrateForces()
Calls the built-in force integration code.
- isSleeping
bool isSleeping()
- opAssign
typeof(null) opAssign(typeof(null) n)
- opEquals
bool opEquals(PhysicsDirectBodyState other)
- opEquals
bool opEquals(typeof(null) n)
- setAngularVelocity
void setAngularVelocity(Vector3 velocity)
- setLinearVelocity
void setLinearVelocity(Vector3 velocity)
- setSleepState
void setSleepState(bool enabled)
- setTransform
void setTransform(Transform transform)
- toHash
size_t toHash()
- angularVelocity
Vector3 angularVelocity [@property getter]
Vector3 angularVelocity [@property setter]
The body's rotational velocity.
- centerOfMass
Vector3 centerOfMass [@property getter]
- inverseInertia
Vector3 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
Vector3 linearVelocity [@property getter]
Vector3 linearVelocity [@property setter]
The body's linear velocity.
- principalInertiaAxes
Basis principalInertiaAxes [@property getter]
- sleeping
bool sleeping [@property getter]
bool sleeping [@property setter]
If true, 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
Vector3 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
Transform transform [@property getter]
Transform transform [@property setter]
The body's transformation matrix.
Direct access object to a physics body in the PhysicsServer.
Provides direct access to a physics body in the PhysicsServer, allowing safe changes to physics properties. This object is passed via the direct state callback of rigid/character bodies, and is intended for changing the direct state of that body. See RigidBody._integrateForces.