410 likes | 826 Views
CS274: Computer Animation and Simulation. Lecture VII. Rigid Body Dynamics. Rigid Bodies. Rigid bodies have both a position and orientation. Rigid bodies assume no object deformation. Rigid body motion is represented by 2 parameters. - center of mass. - orientation (rotation matrix).
E N D
CS274: Computer Animation and Simulation Lecture VII Rigid Body Dynamics
Rigid Bodies Rigid bodies have both a position and orientation Rigid bodies assume no object deformation Rigid body motion is represented by 2 parameters - center of mass - orientation (rotation matrix)
Rigid Bodies Objects are defined in body space and transformed by the position and orientation into world space
Linear Velocity The change of the center of mass over time For a pure translation ( constant), all points move with velocity
Angular Velocity The change in orientation over time • Encodes both the axis and speed of the rotation • direction encodes the axis • magnitude encodes the speed (rad/s) But, how are and related?
Angular Velocity For a given vector The columns of represent the transformed axes
Angular Velocity We can represent the cross product with a matrix Therefore
Velocity of a Point Since a point can be represented at any time by Total velocity can then be expressed as Which can be rewritten as
Force We can apply forces to the object at any point Total force on an object is simply No information about where the forces are applied
Torque Torque describes the “rotational force” Total torque on an object is simply Tells us about the force distribution over the object
density integration over the body Linear Momentum Linear momentum of a particle is Linear momentum of a rigid body is then
Linear Momentum Linear momentum can be simplified as follows Assuming constant mass gives
inertia tensor Angular Momentum Angular momentum of a rigid body Taking the time derivative Angular momentum is conserved for no torque
Inertia Tensor Describes how mass is distributed in the body Analogous to mass in linear velocity Measures the preferred axis of rotation Expensive to compute this at every time step
Inertia Tensor Rewrite the tensor as Integrals can now be precomputed
Rigid Body Equations of Motion Combining the equations Discretize these continuous equations and integrate
Using Quaternions Use quaternions to represent orientation The update rule is then
Rigid Body Equations of Motion Using quaternions gives Discretize these continuous equations and integrate
Collisions and Contact So far, no interaction between rigid bodies Collision detection – determining if, when and where a collision occurs Collision response – calculating the state (velocity, …) after the collision
Collisions and Contact What should we do when there is a collision?
Rolling Back the Simulation Restart the simulation at the time of the collision Collision time can be found by bisection, etc.
Collision Detection Exploit coherency through witnessing Two convex objects are non-penetrating iff there exists a separating plane between them separating plane First find a separating plane and see if it is still valid after the next simulation step Speed up with bounding boxes, grids, hierarchies, etc.
Collision Detection Conditions for collision separating contact colliding
Collision Soft Body Collision Force is applied to prevent interpenetration
Collision Soft Body Collision Apply forces and change the velocity
Collision Harder Collision Higher force over a shorter time
Collision Rigid Body Collision Impulsive force produces a discontinuous velocity
Impulse We need to change velocity instantaneously Infinite force in an infinitesimal time An impulse changes the velocity as or
Impulse An impulse also creates an impulsive torque The impulsive torque changes the angular velocity or
Impulse For a frictionless collision But how do we calculate ?
Impulse For a frictionless collision Given this equation and knowing how affects the linear and angular velocities of the two bodies, we can solve for
Resting Contact Bodies are neither colliding nor separating We want a force strong enough to resist penetration but only enough to maintain contact
Since we should keep it from decreasing Since we should keep it from decreasing Resting Contact We want to prevent interpenetration Describes the objects’ acceleration towards one another
avoid interpenetration • be repulsive • become zero if the bodies begin to separate workless force Resting Contact Contact forces only act in the normal direction Contact forces should
Resting Contact The relative accelerations can be written in terms of all of the contact forces So we can simply solve a Quadratic Program to find the solution to all the constraints
compute new state detect collisions and backtrack compute and apply impulses compute and apply constraint forces Simulation Algorithm Algorithm with collisions and contact current state next state collision state post-collision state