L14_RigidBody
Download
Report
Transcript L14_RigidBody
Rigid Body Dynamics
simulate basic physics of an object
subject to forces
Keyframing can be tedious - especially to get ‘realism’
Simulate physics by
- programming equations of motions
- setting initial conditions
Animator gives up control
Animator gets ‘realistic’ motion automatically.
Rick Parent - CIS682
Siimulation Update Cycle
Object properties
Position, orientation
Linear and angular velocity
Linear and angular momentum
mass
Update object properties
Calculate forces
Calculate accelerations
Using mass, momenta
Rick Parent - CIS682
Object under Forces
Forces
Gravity
Wind
Springs
Collision avoidance
Soft constraints
Calculate acceleration due to forces
Calculate update to object velocity & position
Rick Parent - CIS682
Object under Linear Force
Given: force, f(t), gives rise to acceleration, a(t), or x(ti )
Use a(t) to update current state of point mass: x(t), v(t)
x(ti 1 ) x(ti ) x (ti )t
x (ti 1 ) x (ti ) x(ti )t
( x (ti ) x (ti 1 ))
x(ti 1 ) x(ti )
t
2
1
x(ti 1 ) x(ti ) x (ti )t x(ti )t 2
2
Rick Parent - CIS682
Equations of Motion
Linear force
Angular force: torque
Linear momentum
Angular momentum
Conserved in a closed system
Resistance to linear force: mass
Resistance to angular force: inertia tensor.
Rick Parent - CIS682
Rotational Movement
Represent orientation with rotation matrix: R(t)
Represent angular velocity with vector: w(t)
- direction is axis of rotation
- magnitude is speed of rotation
Angular velocity insensitive to distance from center or rotation
Rick Parent - CIS682
Rotational Movement
w(t) - angular velocity
w(t)
a b r(t)
r(t) - position of a relative to b
b - point on axis of rotation
r (t)
q - angle r(t) makes with axis of rotation
q
b
r(t ) w (t ) r (t )
r(t ) w (t ) r (t ) sin( q )
Rick Parent - CIS682
Rotational Movement
R(t) - rotation matrix representing the orientation of a rigid body
Columns are vectors to positions a unit length on principle axis
R(t) R1(t) R2 (t) R3 (t)
Change in rotation matrix can be computed by
taking cross product of w(t) with each column
R (t ) w (t ) R1 (t ) w (t ) R2 (t ) w (t ) R3 (t )
Rick Parent - CIS682
Rotational Movement
R (t ) w (t ) R1 (t ) w (t ) R2 (t ) w (t ) R3 (t )
Define the following for notational convenience to
define cross product as a matrix operation:
w y Az w z Ay
w A w z Ax w x Az
w x Ay w y Ax
0
wz
w y
wz
0
wx
w y Ax
w x Ay w * A
0 Az
Rick Parent - CIS682
Velocity of a Point
q - original position of point in rigid body
x(t) - position of rigid body
v(t) - velocity of rigid body
q(t) – time-dependent position of point in rigid
body
q(t ) R(t )q x(t )
q (t ) R (t )q x (t )
*
R(t ) w (t ) R(t )
q (t ) w (t ) R(t )q v(t )
Rick Parent - CIS682
Center of Mass
Object’s “position” is the position of its center of mass
Integration of differential mass times position in object
Approximate by summing over representational particles in object
M mi
m q (t)
x(t)
i i
M
Mass is the object’s resistance to a change in velocity
Rick Parent - CIS682
Force and Torque
F ma
a F /m
Force on center of mass results
in linear acceleration
F
F (t ) f i (t )
i (t ) (q(t ) x(t )) f i (t )
(t ) i (t )
Force off-center of mass is torque and
creates angular acceleration - what is
angular mass?
F
Rick Parent - CIS682
But first…Linear Momentum
p mv
Mass times velocity
P(t ) mi vi (t )
P(t ) Mv (t )
Sum over all particles of object
Use total mass for linear momentum
P (t ) Mv(t ) F (t )
Change in (linear)
momentum is equal
to force
Rick Parent - CIS682
Angular Momentum -
measure of rotating
mass weighted by its distance from the axis of rotation
Relative position of particle
Relative velocity of particle
mass
L(t ) ((q(t ) x(t )) mi (q (t ) v(t ))
( R(t )q mi (w(t ) (q(t ) x(t ))))
(mi ( R(t )q (w(t ) R(t )q)))
Factor out mass
Rick Parent - CIS682
Angular Momentum
L(t) (mi (R(t)q (w(t) R(t)q)))
Define Inertia Tensor, I(t), that captures distribution of mass
L(t ) I (t )w (t )
L (t ) (t )
Similar to the linear case, the change in
Angular Momentum is equal to torque
Rick Parent - CIS682
Inertia Tensor -
object’s resistance to a
change in rotational velocity
Ixx
Iobject Ixy
Ixz
Ixx
Ixz
Iyz
Izz
Ixy
Iyy
Iyz
(q)(q
y
2
2
qz )dxdydz
I(t) R(t)Iobject R(t)
T
Rick Parent - CIS682
Inertia Tensor
Ixx
(q)(q
y
Ixx mi (y i zi )
2
2
2
2
qz )dxdydz
Ixy m i x i y i
Iyy mi (x i zi )
Ixz m i x i zi
Izz mi (x i y i )
Iyz m i y i zi
2
2
2
2
Rick Parent - CIS682
Inertia Tensor for a Cuboid
M (b2 + c2)
0
0
0
M (a2 + c2)
0
0
0
M (a2 + b2)
1
12
Rick Parent - CIS682
Finally, the Equations - State vector
S (t) =
x (t)
Update with velocity
R (t)
Update with angular velocity
P (t)
Update with force
L (t)
Update with torque
Given: S(t), M, Iobject
I(t) R(t)Iobject R(t)
*
R(t ) w (t ) R(t )
P (t ) Mv(t ) F (t )
w(t) I(t) L(t)
L (t ) (t )
v(t) P(t) / M
T
1
Rick Parent - CIS682
Update State Vector
x(t) v(t)
*
d
d R(t) w (t) R(t)
S(t)
dt
dt P(t) F (t)
L(t) (t)
Rick Parent - CIS682
Update Orientation - options
R(t) += w (t) * R(t) and re-orthonormalize
Extract axis-angle from w (t) and rotate columns of R(t)
Use quaternions to rotate quaternion version of R(t)
Rick Parent - CIS682
QuickTime™ and a
Video decompressor
are needed to see this picture.
Rick Parent - CIS682
Now, what about collisions?
Rick Parent - CIS682