class
IRigidbodyImplementation
Low-level interface for a rigidbody used by the Rigidbody component.
Should be implemented by the physics plugin to provide rigidbody functionality.
Public
Methods
~IRigidbodyImplementation
Move
Moves the rigidbody to a specific position.
This method will ensure physically correct movement, meaning the body will collide with other objects along the way.
Rotate
Rotates the rigidbody.
This method will ensure physically correct rotation, meaning the body will collide with other objects along the way.
SetMass
Determines the mass of the object and all of its collider shapes.
Only relevant if RigidbodyFlag::AutoMass or RigidbodyFlag::AutoTensors is turned off. Value of zero means the object is immovable (but can be rotated).
SetIsKinematic
Determines if the body is kinematic.
Kinematic body will not move in response to external forces (for example gravity, or another object pushing it), essentially behaving like collider. Unlike a collider though, you can still move the object and have other dynamic objects respond correctly (meaning it will push other objects).
IsSleeping
Checks if the body is sleeping.
Objects that aren't moved/rotated for a while are put to sleep to reduce load on the physics system.
Sleep
Forces the object to sleep.
Useful if you know the object will not move in any significant way for a while.
WakeUp
Wakes an object up.
Useful if you modified properties of this object, and potentially surrounding objects which might result in the object being moved by physics (although the physics system will automatically wake the object up for majority of such cases).
SetSleepThreshold
Determines a threshold of force and torque under which the object will be considered to be put to sleep.
SetUseGravity
Determines whether or not the rigidbody will have the global gravity force applied to it.
SetVelocity
Determines the linear velocity of the body.
GetVelocity
SetAngularVelocity
Determines the angular velocity of the body.
GetAngularVelocity
SetDrag
Determines the linear drag of the body.
Higher drag values means the object resists linear movement more.
SetAngularDrag
Determines the angular drag of the body.
Higher drag values means the object resists angular movement more.
SetInertiaTensor
Determines the inertia tensor in local mass space.
Inertia tensor determines how difficult is to rotate the object. Values of zero in the inertia tensor mean the object will be unable to rotate around a specific axis. Only relevant if RigidbodyFlag::AutoTensors is turned off.
GetInertiaTensor
SetMaxAngularVelocity
Determines the maximum angular velocity of the rigidbody.
Velocity will be clamped to this value.
SetFlags
Flags that control the behaviour of the rigidbody.
AddForce
Applies a force to the center of the mass of the rigidbody.
This will produce linear momentum.
- force
- Force to apply.
- mode
- Determines what is the type of .
AddTorque
Applies a torque to the rigidbody.
This will produce angular momentum.
- torque
- Torque to apply.
- mode
- Determines what is the type of .
AddForceAtPoint
Applies a force to a specific point on the rigidbody.
This will in most cases produce both linear and angular momentum.
- force
- Force to apply.
- position
- World position to apply the force at.
- mode
- Determines what is the type of .
GetVelocityAtPoint
Returns the total (linear + angular) velocity at a specific point.
- point
- Point in world space.
Returns: Total velocity of the point.
UpdateMassDistribution
Recalculates rigidbody's mass, inertia tensors and center of mass depending on the currently set child colliders.
This should be called whenever relevant child collider properties change (like mass or shape).
If automatic tensor calculation is turned off then this will do nothing. If automatic mass calculation is turned off then this will use the mass set directly on the body using SetMass().
SetTransform
Sets the transform of the low-level physics rigidbody object.
GetTransform
Returns the transform that is currently assigned to the low-level physics rigidbody object.
This may be the transform you explicitly set via SetTransform(), or a value that has been calculated by physics simulation for kinematic rigidbodies.
SetCenterOfMass
Sets the rigidbody's center of mass transform.
Only relevant if RigibodyFlag::AutoTensors is turned off.
- position
- Position of the center of mass.
- rotation
- Rotation that determines orientation of the inertia tensor (rotation of the center of mass frame).
GetCenterOfMass
Gets the rigidbody's center of mass transform.
- outPosition
- Position of the center of mass.
- outRotation
- Rotation that determines orientation of the inertia tensor (rotation of the center of mass frame).
SetSolverIterationCounts
Determines the number of iterations to use when solving for position and velocity.
Higher values can improve precision and numerical stability of the simulation.
AddToScene
Adds the rigidbody to the physics scene.
RemoveFromScene
Removes the rigidbody from the currently assigned physics scene.
AttachShape
Assigns a new child shape to the rigidbody.
DetachShape
Removes a shape that was previously attached to the rigidbody.