Download - Dynamics 101
![Page 2: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/2.jpg)
2
Talk Summary
Going to talk about: A brief history of motion theory Newtonian motion for linear and
rotational dynamics Handling this in the computer
![Page 3: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/3.jpg)
3
Physically Based-Motion
Want game objects to move consistent with world
Match our real-world experience But this is a game, so… Can’t be too expensive (no atomic-level interactions)
![Page 4: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/4.jpg)
4
History I: Aristotle
Observed: Push an object, stop, it stops Rock falls faster than feather
From this, deduced: Objects want to stop Motion is in a line Motion only occurs with action Heavier object falls faster
Note: was not actually beggar for a bottle
![Page 5: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/5.jpg)
5
History I: Aristotle
Motion as changing position
![Page 6: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/6.jpg)
6
History I: Aristotle
Called kinematics Games: move controller, stop on a
dime, move again Not realistic
![Page 7: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/7.jpg)
7
History II: Galileo
Observed: Object in motion slows down Cannonballs fall equally
Theorized: Slows due to unseen force: friction Object in motion stays in motion Object at rest stays at rest Called inertia Also: force changes velocity, not position Oh, and mass has no effect on velocity
![Page 8: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/8.jpg)
8
History II: Galileo
Force as changing velocity Velocity changes position
Called dynamics
![Page 9: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/9.jpg)
9
History III: Newton
Observed: Planet orbit like continuous falling
Theorized: Planet moves via gravity Planets and small objects linked Force related to velocity by mass Calculus helps formulate it all
![Page 10: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/10.jpg)
10
History III: Newton
Sum of forces sets acceleration Acceleration changes velocity Velocity changes position g
![Page 11: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/11.jpg)
11
History III: Newton
Games: Move controller, add force, then drift
![Page 12: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/12.jpg)
12
History III: Newton
As mentioned, devised calculus (concurrent with Leibniz)
Differential calculus: rates of change
Integral calculus: areas and volumes antiderivatives
![Page 13: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/13.jpg)
13
Differential Calculus Review
Have position function x(t) Derivative x'(t) describes how x
changes as t changes (also written dx/dt, or )
x'(t) gives tangent vector at time t
y(t)
y
t
x(ti)
x'(ti)€
˙ x
![Page 14: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/14.jpg)
14
Differential Calculus Review
Our function is position: Derivative is velocity:
Derivative of velocity is acceleration
)(tx
xx
xv &==′=dtd
tt )()(
xx
x
vv
va
&&
&
==′′=
==′=
2
2
)(
)()(
dtd
t
dtd
tt
![Page 15: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/15.jpg)
15
Newtonian Dynamics Summary
All objects affected by forces Gravity Ground (pushing up) Other objects pushing against it
Force determines acceleration (F = ma)
Acceleration changes velocity ( ) Velocity changes position ( )
av=
dtd
vx=
dtd
![Page 16: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/16.jpg)
16
Dynamics on Computer
Break into two parts Linear dynamics (position) Rotational dynamics (orientation)
Simpler to start with position
![Page 17: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/17.jpg)
17
Linear Dynamics
Simulating a single object with: Last frame position xi
Last frame velocity vi
Mass m Sum of forces F
Want to know Current frame position xi+1
Current frame velocity vi+1
![Page 18: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/18.jpg)
18
Linear Dynamics
Could use Newton’s equations
Problem: assumes F constant across frame
Not always true: E.g. spring force: Fspring = –kx
E.g. drag force: Fdrag = –mv
€
a = F /m
x i+1 = x i + vit +1/2at 2
vi+1 = vi + at
![Page 19: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/19.jpg)
19
Linear Dynamics
Need numeric solution Take stepwise approximation of
function
![Page 20: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/20.jpg)
20
Linear Dynamics
Basic idea: derivative (velocity) is going in the right direction
Step a little way in that direction (scaled by frame time h)
Do same with velocity/acceleration Called Euler’s method
![Page 21: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/21.jpg)
21
Linear Dynamics
Euler’s method
€
x i+1 = x i + hvi
a = F(x i,vi) /m
vi+1 = vi + ha
![Page 22: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/22.jpg)
22
Linear Dynamics
Another way: use linear momentum
Then
€
P = mv˙ P = F
€
x i+1 = x i + hvi
Pi+1 = Pi + hF(x i,vi)
vi+1 = Pi+1 /m
![Page 23: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/23.jpg)
23
Linear: Final Formulas
Using Euler’s method with time step h
€
F = Fk (k
∑ x i,vi)
a i =F
mx i+1 = x i + hvi
vi+1 = vi + ha i
![Page 24: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/24.jpg)
24
Rotational Dynamics
Simulating a single object with: Last frame orientation Ri or qi
Last frame angular velocity i
Inertial tensor I Sum of torques
Want to know Current frame orientation Ri+1 or qi+1
Current frame ang. velocity i+1
![Page 25: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/25.jpg)
25
Rotational Dynamics
Orientation Represented by
Rotation matrix R Quaternion q
Which depends on your needs Hint: quaternions are cheaper
![Page 26: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/26.jpg)
26
Rotational Dynamics
Angular velocity Represents change in rotation How fast object spinning 3-vector
Direction is axis of rotation Length is amount of rotation (in radians) Ccw around axis (r.h. rule)
![Page 27: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/27.jpg)
27
Rotational Dynamics
Angular velocity Often need to know linear velocity at
point Solution: cross product
r
v
€
×r = v
![Page 28: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/28.jpg)
28
Moments of Inertia
Inertial tensor I is rotational equivalent of mass 3 x 3 matrix, not single scalar factor
(unlike m) Many factors - rotation depends on shape Describe how object rotates around
various axes Not always easy to compute Change as object changes orientation
![Page 29: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/29.jpg)
29
Rotational Dynamics
Computing I Can use values for closest box or cylinder Alternatively, can compute based on
geometry Assume constant density, constant mass at
each vertex Solid integral across shape See Mirtich,Eberly for more details Blow and Melax do it with sums of tetrahedra
![Page 30: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/30.jpg)
30
Rotational Dynamics
Torque Force equivalent Apply to offset from center of mass –
creates rotation Add up torques just like forces
![Page 31: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/31.jpg)
31
Computing torque Cross product of vector r (from CoM to
point where force is applied), and force vector F
Applies torque ccw around vector (r.h. rule)
Rotational Dynamics
r F
€
=r × F
![Page 32: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/32.jpg)
32
Rotational Dynamics
Center of Mass Point on body where applying a force acts just
like single particle “Balance point” of object Varies with density, shape of object
Pull/push anywhere but CoM, get torque Generally falls out of inertial tensor calculation
![Page 33: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/33.jpg)
33
Rotational Dynamics
Have matrix R and vector How to compute ? Convert to give change in R
Convert to symmetric skew matrix Multiply by orientation matrix Can use Euler's method after that
€
Ri+1 = Ri + hωi
![Page 34: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/34.jpg)
34
Computing New Orientation
If have matrix R, then
€
˜ ω =
0 −ω3 ω2
ω3 0 −ω1
−ω2 ω1 0
⎛
⎝
⎜ ⎜ ⎜
⎞
⎠
⎟ ⎟ ⎟
€
Ri+1 = Ri + h ˜ ω iRi
where
![Page 35: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/35.jpg)
35
Computing New Orientation
If have quaternion q, then
See Baraff or Eberly for derivation
€
wi = (0,ωi)
iiii
hqwqq
21 +=+
where
![Page 36: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/36.jpg)
36
Computing Angular Velocity
Can’t easily integrate angular velocity from angular acceleration:
Can no longer “divide” by I and do Euler step €
=Iα
= I ˙ ω + ω × Iω
![Page 37: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/37.jpg)
37
Computing Angular Momentum
Easier way: use angular momentum
Then
€
L = Iω˙ L = τ
€
Li+1 = Li + hτ (Ri,ωi)
ωi+1 = Ii+1−1 Li+1
![Page 38: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/38.jpg)
38
Remember, I computed in local space, must
transform to world space If using rotation matrix R, use
formula
If using quaternion, convert to matrix
Using I in World Space
€
=I−1L
iTiiii LRIRLI 1
01 −− =
![Page 39: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/39.jpg)
39
Rotational Formulas
€
Ω= rk × Fk
k
∑
Ri+1 = Rn + h ˜ ω iRi
Li+1 = Li + hΩ
Ii+1−1 = Ri+1I0
−1Ri+1T
ωi+1 = Ii+1−1 Li+1
![Page 40: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/40.jpg)
40
Impulses
Normally force acts over period of time
E.g., pushing a chair
F
t
![Page 41: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/41.jpg)
41
Impulses
Even if constant over frame
sim assumes application over entire time
F
t
![Page 42: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/42.jpg)
42
Impulses
But if instantaneous change in velocity? Discontinuity!
Still force, just instantaneous Called impulse - good for collisions/constraints
F
t
![Page 43: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/43.jpg)
43
Summary
Basic Newtonian dynamics Position, velocity, force, momentum
Linear simulation Force -> acceleration -> velocity ->
position Rotational simulation
Torque -> ang. mom. -> ang. vel. -> orientation
![Page 44: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/44.jpg)
44
Questions?
![Page 45: Dynamics 101](https://reader036.vdocuments.us/reader036/viewer/2022070400/568134c0550346895d9be454/html5/thumbnails/45.jpg)
45
References
Burden, Richard L. and J. Douglas Faires, Numerical Analysis, PWS Publishing Company, Boston, MA, 1993.
Hecker, Chris, “Behind the Screen,” Game Developer, Miller Freeman, San Francisco, Dec. 1996-Jun. 1997.
Witken, Andrew, David Baraff, Michael Kass, SIGGRAPH Course Notes, Physically Based Modelling, SIGGRAPH 2002.
Eberly, David, Game Physics, Morgan Kaufmann, 2003.