Академический Документы
Профессиональный Документы
Культура Документы
Game Physics
Linear physics physics of points
particle systems, ballistic motion
key simplification: no orientation
Rotational physics
orientation can change
Rigid Bodies
No longer points: distribution of mass
instead.
Rigid bodies: distances between mass
elements never change.
Orientation of body can change over time.
Rotation
Rigid bodies also have orientation
Treating rotation properly is complicated
Rotation is not a vector (rotations do not
commute, i.e., order of rotations matters)
No analog to x, v, a in rotations?
Angular velocity
Infinitesimally small rotations do commute
Suppose we have a rigid body rotating
about an axis
Angular velocity
Connection between linear and angular
velocity
Magnitudes: v = rperp
Want vector relation
Nice to have angular velocity about axis of
rotation (so it doesn't have to change all
the time for an object spinning in place)
Let v = x r
Angular velocity
v=xr
Or, = r x v / |r|2
Note: , r, v vectors
Angular velocity defined this way so that
constant angular velocity behaves sensibly
spinning top has constant
Applying force
What happens when you push on a
spinning object? (exert force)
F=ma, so we know the movement of the
centre of mass
How does the force affect orientation?
Torque
T=rxF
r is vector from origin to location where
force applied
for convenience, often take origin to be center
of mass of object
F is force
Magnitude proportional to force,
proportional to distance from origin
Direction of Torque
T=rxF
Perpendicular to both location and force
vectors
Direction is along axis about which
rotation is induced
Right hand rule: thumb along axis, fingers
curl in direction of rotation
single particle
T = r F sin
T = r Ft
Ft = mat = mr
T = mr2
Let I = mr2
T = I
Many particles
Real objects are (pretty much) continuous
Game objects: distribution of point masses
not always, but common
Angular momentum
Define angular momentum similarly to
torque:
L=rxp
Note that with this definition, T = dL/dt, just
as F = dp/dt
angular quantity
velocity v
angular velocity
acceleration a
angular acc.
mass m
moment of inertia I
p = mv
L = I
F = ma
T = I
Conservation of Angular
Momentum
Consequence of T = dL/dt:
If net torque is zero, angular momentum is
unchanged
Moment of Inertia
Said that moment of inertia of a point
particle is mr^2
In the general case, I = r^2 dV where r
is the distance perpendicular to the axis of
rotation
Don't know the axis of rotation beforehand
Moment of Inertia
I = (x,y,z) y^2 + z^2 -xy
-xz
-xy
-xz
-yz
dxdydz
x^2+y^2
Ixx 0
0
Iyy 0
0 IxxIzz
where,0 e.g.,
= m(y*y + z*z)
Off-diagonal entries called "products of
inertia"
Moment of Inertia
In general, the more compact a body is,
the smaller the moments of inertia, and
the faster it will spin (for the same torque)
Fake I
Not doing engineering simulation
(prediction of how real objects will behave)
Can invent I rather than integrating
Large values: hard to rotate about this axis
Avoid off-diagonal elements
Fake constants
For that matter, can fake lots of stuff
Different gravity for different objects
e.g., slow bullets in FPS
e.g., fast falling in platformer
Case in 2D
In 2D, the vectors T, , become scalars
(their direction is known only magnitude
is needed)
Moment of inertia becomes a scalar too:
I = prdA
Rigid body in 3D
Need some way to represent general
orientation
Need to be able to compose changes in
orientation efficiently
Quaternions
Quaternion: structure for representing
rotation
unit vector (axis of rotation)
scalar (amount of rotation)
recall, store (cos(/2), v sin(/2) )
Quaternions
Rotation of about axis v:
q = (cos(/2), v sin(/2))
Quaternion Rotation
To rotate a vector r by about axis v:
take q = (cos(/2), v sin(/2)
Let p = (0,r)
obtain p' from the quaternion resulting from
qpq-1
p' = (0, r')
r' is the rotated vector r
Rotation Differentiation
Note:
q(t) = (s(t), v(t))
q(t) = [ cos((t)/2), u sin((t)/2) ]
For a body rotating with constant angular
velocity , it can be shown
q(t) = [0, ] q(t)
Summarize this q(t)
d/dt
x(t)
v(t)
q(t)
q(t)
P(t)
L(t)
F(t)
T(t)
P and L
Note that
v = P/m (from P=mv)
= I-1L (from L = I)
Impulse
Sudden change in momentum
also, angular momentum (impulsive torque)