RigidBody

class RigidBody : System.Object, IBroadphaseEntity, IDebugDrawable, System.IEquatable<RigidBody>, System.IComparable<RigidBody>

The RigidBody class.

bool IsParticle

If true, the body as no angular movement.

readonly Jitter.DataStructures.ReadOnlyHashset<Arbiter> Arbiters
readonly Jitter.DataStructures.ReadOnlyHashset<Constraint> Constraints
bool AllowDeactivation

If set to false the body will never be deactived by the world.

bool EnableSpeculativeContacts
readonly JBBox BoundingBox

The axis aligned bounding box of the body.

readonly CollisionIsland CollisionIsland

Gets the current collision island the body is in.

bool IsActive

If set to false the velocity is set to zero, the body gets immediately freezed.

readonly JVector Torque

Returns the torque which acts this timestep on the body.

JVector Force

Returns the force which acts this timestep on the body.

System.Object Tag

Allows to set a user defined value to the body.

System.WeakReference<Object> WeakTag

Allows to set a weakly referenced user defined value to the body.

readonly System.Object WeakTagOrNull

Returns the value assigned in P:Jitter.Dynamics.RigidBody.WeakTag or null if it is garbage collected or unset.

Shape Shape

The shape the body is using.

Jitter.Dynamics.DampingType Damping
Material Material
readonly JMatrix Inertia

The inertia currently used for this body.

readonly JMatrix InverseInertia

The inverse inertia currently used for this body.

JVector LinearVelocity

The velocity of the body.

JVector AngularVelocity

The angular velocity of the body.

JVector Position

The current position of the body.

JMatrix Orientation

The current oriention of the body.

bool IsStatic

If set to true the body can’t be moved.

bool AffectedByGravity
readonly JMatrix InverseInertiaWorld

The inverse inertia tensor in world space.

float Mass

Setting the mass automatically scales the inertia. To set the mass indepedently from the mass use SetMassProperties.

int BroadphaseTag
readonly bool IsStaticOrInactive
bool EnableDebugDraw
bool PureCollider
public int GetHashCode()

Calculates a hashcode for this RigidBody. The hashcode should be unique as possible for every body.

Returns:The hashcode.
public void ApplyImpulse(JVector impulse)

Applies an impulse on the center of the body. Changing linear velocity.

Parameters:
  • impulse (Jitter.LinearMath.JVector) – Impulse direction and magnitude.
public void ApplyImpulse(JVector impulse, JVector relativePosition)

Applies an impulse on the specific position. Changing linear and angular velocity.

Parameters:
  • impulse (Jitter.LinearMath.JVector) – Impulse direction and magnitude.
  • relativePosition (Jitter.LinearMath.JVector) –
    The position where the impulse gets applied
    in Body coordinate frame.
public void AddForce(JVector force)

Adds a force to the center of the body. The force gets applied the next time :World.Step is called. The ‘impact’ of the force depends on the time it is applied to a body - so the timestep influences the energy added to the body.

Parameters:
  • force (Jitter.LinearMath.JVector) – The force to add next :World.Step.
public void AddForce(JVector force, JVector pos)

Adds a force to the center of the body. The force gets applied the next time :World.Step is called. The ‘impact’ of the force depends on the time it is applied to a body - so the timestep influences the energy added to the body.

Parameters:
  • force (Jitter.LinearMath.JVector) – The force to add next :World.Step.
  • pos (Jitter.LinearMath.JVector) – The position where the force is applied.
public void AddTorque(JVector torque)

Adds torque to the body. The torque gets applied the next time :World.Step is called. The ‘impact’ of the torque depends on the time it is applied to a body - so the timestep influences the energy added to the body.

Parameters:
  • torque (Jitter.LinearMath.JVector) – The torque to add next :World.Step.
public void SetMassProperties()

By calling this method the shape inertia and mass is used.

public void SetMassProperties(JMatrix inertia, float mass, bool setAsInverseValues)

The engine used the given values for inertia and mass and ignores the shape mass properties.

Parameters:
  • inertia (Jitter.LinearMath.JMatrix) – The inertia/inverse inertia of the untransformed object.
  • mass (float) – The mass/inverse mass of the object.
  • setAsInverseValues (bool) –
    Sets the InverseInertia and the InverseMass
    to this values.
public void SweptExpandBoundingBox(float timestep)
Parameters:
  • timestep (float) –
public void Update()

Recalculates the axis aligned bounding box and the inertia values in world space.

public bool Equals(RigidBody other)
Parameters:
  • other (Jitter.Dynamics.RigidBody) –
public int CompareTo(RigidBody other)
Parameters:
  • other (Jitter.Dynamics.RigidBody) –
public void PreStep(float timestep)
Parameters:
  • timestep (float) –
public void PostStep(float timestep)
Parameters:
  • timestep (float) –
public void DebugDraw(IDebugDrawer drawer)
Parameters:
  • drawer (Jitter.IDebugDrawer) –