public abstract class PhysicsDirectBodyState : Object

Inheritance Chain


    public Vector3 AngularVelocity { get; set; }

The angular velocity of the body.

    public Vector3 CenterOfMass { get; }

    public Vector3 InverseInertia { get; }

The inverse of the inertia of the body.

    public float InverseMass { get; }

The inverse of the mass of the body.

    public Vector3 LinearVelocity { get; set; }

The linear velocity of the body.

    public Basis PrincipalInertiaAxes { get; }

    public bool Sleeping { get; set; }

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

    public float Step { get; }

The timestep (delta) used for the simulation.

    public float TotalAngularDamp { get; }

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

    public Vector3 TotalGravity { get; }

The total gravity vector being currently applied to this body.

    public float TotalLinearDamp { get; }

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

    public Transform Transform { get; set; }

The transformation matrix of the body.


    public void AddCentralForce(Vector3 force)

Adds a constant directional force without affecting rotation.

This is equivalent to add_force(force, Vector3(0,0,0)).

    public void AddForce(Vector3 force, Vector3 position)

Adds a constant force (i.e. acceleration).

    public void AddTorque(Vector3 torque)

Adds a constant rotational force (i.e. a motor) without affecting position.

    public void ApplyCentralImpulse(Vector3 j)

Applies a single directional impulse without affecting rotation.

This is equivalent to apply_impulse(Vector3(0, 0, 0), impulse).

    public 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.

    public 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 passed in vector.

    public Vector3 GetAngularVelocity()

Getter for AngularVelocity

    public Vector3 GetCenterOfMass()

Getter for CenterOfMass

    public RID GetContactCollider(int contactIdx)

    public int GetContactColliderId(int contactIdx)

    public Object GetContactColliderObject(int contactIdx)

    public Vector3 GetContactColliderPosition(int contactIdx)

    public int GetContactColliderShape(int contactIdx)

    public Vector3 GetContactColliderVelocityAtPosition(int contactIdx)

    public int GetContactCount()

    public float GetContactImpulse(int contactIdx)

Impulse created by the contact. Only implemented for Bullet physics.

    public Vector3 GetContactLocalNormal(int contactIdx)

    public Vector3 GetContactLocalPosition(int contactIdx)

    public int GetContactLocalShape(int contactIdx)

    public Vector3 GetInverseInertia()

Getter for InverseInertia

    public float GetInverseMass()

Getter for InverseMass

    public Vector3 GetLinearVelocity()

Getter for LinearVelocity

    public Basis GetPrincipalInertiaAxes()

Getter for PrincipalInertiaAxes

    public PhysicsDirectSpaceState GetSpaceState()

    public float GetStep()

Getter for Step

    public float GetTotalAngularDamp()

Getter for TotalAngularDamp

    public Vector3 GetTotalGravity()

Getter for TotalGravity

    public float GetTotalLinearDamp()

Getter for TotalLinearDamp

    public Transform GetTransform()

Getter for Transform

    public void IntegrateForces()

    public bool IsSleeping()

Getter for Sleeping

    public void SetAngularVelocity(Vector3 velocity)

Setter for AngularVelocity

    public void SetLinearVelocity(Vector3 velocity)

Setter for LinearVelocity

    public void SetSleepState(bool enabled)

Setter for Sleeping

    public void SetTransform(Transform transform)

Setter for Transform