Expand description
Rigid body dynamics, handling the motion and physical interactions of non-deformable objects.
A RigidBody
is the core component of a physics simulation.
It describes a rigid, non-deformable physics object that can be either dynamic,
kinematic, or static.
Rigid body dynamics includes:
- Motion of rigid bodies based on their
LinearVelocity
andAngularVelocity
. - Acceleration caused by external forces and
Gravity
. - Collision response, preventing objects from overlapping each other,
considering properties such as
Friction
andRestitution
. - Joints connecting rigid bodies to each other.
- Everything else related to the physical behavior and properties of rigid bodies.
Rigid body dynamics does not include:
- Simulation of fluids (liquids and gasses)
- Elasticity (soft bodies)
- Plasticity (permanent deformation)
§Plugins
Plugin | Description |
---|---|
IntegratorPlugin | Handles motion caused by velocity, and applies external forces and gravity. |
SolverPlugin | Solves constraints (contacts and joints). |
CcdPlugin | Performs sweep-based Continuous Collision Detection for bodies with the SweptCcd component to prevent tunneling. |
SleepingPlugin | Manages sleeping and waking for bodies, automatically deactivating them to save computational resources. |
§Accuracy
The engine uses iterative algorithms to approximate the simulation. Thus, results may not be perfectly accurate:
- Constraints (contacts and joints) are not perfectly rigid.
- Objects can overlap, especially in extreme stacking scenarios.
- Contacts can be slightly bouncy even when the
Restitution
is zero. - Joint chains can stretch and in extreme cases have jittery behavior.
- High mass ratios, such as when a very heavy object rests on top of a lighter one, can be difficult for the engine to deal with.
Friction
andRestitution
may not be perfectly accurate.- Objects moving at high speeds can pass through thin and small geometry due to discrete time steps, a phenomenon known as tunneling. This can be mitigated with Continuous Collision Detection.
These caveats are very common for physics engines intended for real-time applications, not something specific to this engine. Approximations are required for several reasons:
- Performance.
- Exact results are simply not possible, especially at the frame rates expected from games and other real-time applications.
- Some differential equations do not have known exact solutions.
- Semi-implicit Euler integration is used to approximate them.
- Some constraints cannot be solved uniquely.
- An iterative Gauss-Seidel solver is used to solve them approximately.
In practice, the results should be accurate enough for most real-time applications. Perfect accuracy is very rarely necessary, if ever, and most of the more visible issues can typically be worked around.
Modules§
- Contains components and functionality for Continuous Collision Detection.
- Applies forces and velocities to bodies in order to move them according to the equations of motion using numerical integration.
- Re-exports common types related to the rigid body dynamics functionality.
- Common components and bundles for rigid bodies.
- Manages sleeping and waking for bodies, automatically deactivating them to save computational resources.
- Manages and solves contacts, joints, and other constraints.