Problemintro
Rigid body simulation
Also called rigid body animation, rigid body dynamics simulation.
Advance the positions, orientations and velocities of rigid bodies over time under forces, collisions, contact and joints.
Rigid body simulation computes how solid objects that do not deform move over time: falling, colliding, sliding, resting in stacks, and hanging from joints. Each body has a position, an orientation, a linear velocity and an angular velocity, and its motion follows the Newton-Euler equations. The hard parts are the places where bodies meet. Rigid bodies cannot overlap, so a collision must change velocities in an instant, a body at rest on another needs a contact force that is just strong enough, and friction decides whether a contact sticks or slides. In computer graphics and games, the goal is usually a plausible motion at a fixed cost per frame, so most methods mix laws of mechanics with models and tuning. This page states the problem and lists its parts; the methods are on the pages linked below.
In plain words
A game has boxes, balls and doors. Each one should fall, bounce, slide and stop the way real things do, many times per second. Between hits, every object just flies, and that part is easy. The hard part is when objects touch. They must not pass into each other. A hit must turn them away at once. A box on a table must stay still and not sink. A box on a slope must slide or hold, depending on how rough the slope is. Doors must stay on their hinges. A simulator splits the work into steps: move the objects, find which ones touch, fix the hits, find the pushes at the places where they rest, and keep the joints together.
Definition
State. Body has mass , the body-frame inertia tensor , and the state
the position of the center of mass, the orientation (a rotation matrix, or a unit quaternion), the linear momentum and the angular momentum, as in Baraff's course notes. The velocities are and , with the world inertia tensor . Without contact,
where is the cross product matrix of , and and are the total force and torque. This is a law of classical mechanics.
Input. The bodies with their shapes, masses and inertia tensors; the initial state; the forces (gravity in 2D or in 3D on these pages, with up); the material values, a coefficient of restitution and a friction coefficient per pair; the joints as constraints ; a time step and an end time.
Output. The states at the times .
Requirements.
- Between contacts, the bodies follow the Newton-Euler equations, up to the error of the integrator.
- No two bodies overlap, or the overlap stays below a tolerance.
- At a contact with normal from to , the normal force or impulse only pushes (), and it is zero when the bodies separate. The relative normal velocity is negative when they approach.
- A collision obeys a restitution law, and friction obeys Coulomb's law .
- Joint constraints hold, up to a tolerance.
- The cost per step is bounded, for interactive use.
Requirements 3 and 4 together are complementarity conditions; see rigid contact complementarity, where the robotics pages use up. The laws in requirement 4 are empirical models with measured coefficients.
Variants
- Collision response only. Bodies bounce and never rest; each collision is resolved by a collision impulse.
- Resting contact without friction. Find contact forces with , accelerations and : a linear complementarity problem.
- Contact with friction. Add Coulomb friction; the instantaneous problem may then have no solution or several (Painleve paradox, up on that page).
- Time stepping. Pose the problem for impulses over one step instead of forces at an instant, as in Stewart-Trinkle time stepping ( up) and in game engines.
- Articulated bodies. Chains and trees of bodies joined by joints, in reduced coordinates; see the articulated body algorithm.
- Nonconvex bodies and stacking. Bodies of any shape, with stable stacks as a requirement; see shock propagation.
Examples
Free fall (computed). A body starts at rest at height 0 and falls for 1 s, with s. The exact height is m. Explicit Euler gives m, and symplectic Euler, which updates the velocity first, gives m. Both are first order; the integrator is part of the method.
A spinning body (computed). A body with , and has and kinetic energy . Without torque, stays fixed in world space while changes as the body turns: the angular velocity is not a conserved quantity.
A ball dropped on the floor. It hits at m/s after a fall of 1 m, and with it bounces to m; its infinitely many bounces end after s (see coefficient of restitution).
A block on a slope. At it sticks for and slides otherwise (see Coulomb friction).
Known algorithms
The parts of a simulator, and the methods for each:
| part | what it does | methods |
|---|---|---|
| integration | advances the state between contacts | symplectic Euler, unit quaternion updates, Runge-Kutta methods; mass properties by Mirtich's method |
| collision detection | finds pairs that touch, their points, normals and depths | broad phase by sweep and prune; narrow phase by GJK, EPA, V-Clip, Lin-Canny; continuous collision detection and conservative advancement for fast bodies; the result is a contact manifold |
| collision response | changes the velocities at a collision | collision impulse, impulse-based simulation |
| resting contact and friction | finds the contact forces or impulses | Baraff's pivoting algorithm, projected Gauss-Seidel, penalty contact, Stewart-Trinkle time stepping, shock propagation for stacks |
| joints | keeps the bodies of a joint together | the same solvers with bilateral rows, Baumgarte stabilization for drift, the articulated body algorithm in reduced coordinates, position-based dynamics |
Bender, Erleben and Trinkle (2014) survey these parts for interactive simulation.
| Algorithm | Time | Space | Properties | Code |
|---|---|---|---|---|
| Baraff's contact force algorithm | O(n) drives | O(n^2) matrix | deterministicnot in placeofflineiterative | 1 language |
| Impulse-based collision response | O(1) one_contact | O(1) extra | deterministicin placeonlineiterative | 1 language |
| Impulse-based simulation | O(n^2) next_event_brute_force | O(n) total | deterministicin placeonlineiterative | 1 language |
| Projected Gauss-Seidel | O(K z) matrix | O(n + z) matrix | deterministicin placeofflineiterative | 1 language |
| Shock propagation | O(n + e) graph_and_levels | O(n + e + c) total | deterministicin placeofflineiterative | 1 language |
Bounds
- Existence can fail. With Coulomb friction, the instantaneous contact problem can have no solution or many; this is Painleve's paradox, surveyed by Stewart (2000). Impulse-based time stepping formulations restore existence.
- Hardness. Deciding whether consistent contact forces exist with Coulomb friction is NP-hard (Baraff 1991).
- Frictionless contact is a convex problem. Without friction, the contact LCP has a symmetric positive semidefinite matrix and is the optimality condition of a convex quadratic program. When lies in the range of , it has a solution, and all solutions give the same accelerations (proved on the page of Baraff's algorithm); the forces need not be unique.
- Cost per step. Collision detection needs at least one test per pair that may touch, and a solver that reads every contact row needs time for rows. Iterative solvers such as projected Gauss-Seidel spend for sweeps, and the needed for a given accuracy grows with the height of a stack (a measurement on that page).
- Zeno behavior. A bouncing ball with makes infinitely many collisions in finite time, so an event-driven simulator cannot reach the end of the bounces without a rule that stops them.
Reductions
- Frictionless resting contact to an LCP and a QP. The contact accelerations are affine in the contact forces, with , so resting contact is the LCP , , (Baraff 1994), which is the KKT system of the quadratic program over (Baraff 1989 used a quadratic program).
- Friction to a nonsymmetric LCP. With a polygonal friction cone, the time stepping problem with friction becomes an LCP with a matrix that is not symmetric (Stewart-Trinkle).
- Collision detection to distance queries. Narrow phase contact generation reduces to distance and penetration depth queries between convex pieces, after a convex decomposition of nonconvex shapes.
Applications
- Games and virtual reality, where the cost per frame is fixed and plausible motion matters more than exact forces.
- Film effects: destruction, falling debris, piles of objects.
- Robotics: simulators for grasping and locomotion, which need forces that match the real ones more closely.
- Engineering: mechanisms, granular media and machine design, with measured friction and restitution values.
References
- David Baraff, Rigid Body Dynamics I, unconstrained motion, in Andrew Witkin and David Baraff, Physically Based Modeling: Principles and Practice, SIGGRAPH 97 course notes, the state of a rigid body (position, orientation, linear and angular momentum), its derivative, and the inertia tensor in world space (general locator)
- David Baraff, Rigid Body Dynamics II, motion with constraints, in Andrew Witkin and David Baraff, Physically Based Modeling: Principles and Practice, SIGGRAPH 97 course notes, colliding contact by impulses and resting contact by contact forces (general locator)
- Jan Bender, Kenny Erleben and Jeff Trinkle, Interactive simulation of rigid body dynamics in computer graphics, Computer Graphics Forum 33(1), 246-270, 2014, the survey of the simulation loop, contact models with friction, joints and the numerical methods for them (general locator)
- David E. Stewart, Rigid-body dynamics with friction and impact, SIAM Review 42(1), 3-39, 2000, existence and uniqueness for rigid bodies with Coulomb friction, Painleve's paradox, and time stepping formulations (general locator)
Where this leads
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag XWJEV5 Edit this page History Report an error Markdown