Upload
varun-kumar
View
55
Download
0
Tags:
Embed Size (px)
DESCRIPTION
w
Citation preview
Rigid Body Motion
Game PhysicsLinear physics physics of pointsparticle systems, ballistic motionkey simplification: no orientation
Rotational physicsorientation can change
Rigid BodiesNo longer points: distribution of mass instead.
Rigid bodies: distances between mass elements never change.
Orientation of body can change over time.
Rigid Body TranslationCan treat translational motion of rigid bodies exactly the same as pointsSingle position (position of center of mass)F=ma (external forces)v = a dtx = v dtmomentum conservation
RotationRigid bodies also have orientationTreating rotation properly is complicatedRotation is not a vector (rotations do not commute, i.e., order of rotations matters)No analog to x, v, a in rotations?
Angular velocityInfinitesimally small rotations do commuteSuppose we have a rigid body rotating about an axis
Can use a notion of angular velocity: = d/dt
Angular velocityConnection between linear and angular velocityMagnitudes: v = rperpWant vector relationNice 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 velocityv = x rOr, = r x v / |r|2
Note: , r, v vectors
Angular velocity defined this way so that constant angular velocity behaves sensiblyspinning top has constant
Applying forceWhat happens when you push on a spinning object? (exert force)F=ma, so we know the movement of the centre of massHow does the force affect orientation?
TorqueT = r x Fr is vector from origin to location where force appliedfor convenience, often take origin to be center of mass of objectF is forceMagnitude proportional to force, proportional to distance from origin
Intuition for TorqueLarger the larger from the centreLever action: small force yields equivalent torque far from fulcrum
Direction of TorqueT = r x FPerpendicular to both location and force vectorsDirection is along axis about which rotation is inducedRight hand rule: thumb along axis, fingers curl in direction of rotation
single particleT = r F sinT = r FtFt = mat = mrT = mr2Let I = mr2T = I
Many particlesReal objects are (pretty much) continuousGame objects: distribution of point massesnot always, but commonCan get reasonable behaviour with (e.g.) four point masses per rigid bodySingle orientation for bodySingle centre of mass (of course)
Changing Coordinate SystemsWe dealt with changing coordinate systems all the time beforeRigid bodies are much simpler if we treat them in a natural coordinate systemorigin at the centre of mass of the bodyor, some other sensible origin: hinge of doorNeed to transform forces into body coordinate system to calculate torqueTransform motion back to world space
Angular momentumDefine angular momentum similarly to torque:L = r x pNote that with this definition, T = dL/dt, just as F = dp/dt
Force and TorqueNote: a force is a force and a torqueMoves body linearly: F=ma, changes linear momentumRotates body: produces torque, changes angular momentum
Linear vs. Angular
linear quantityangular quantityvelocity vangular velocity acceleration aangular acc. mass mmoment of inertia Ip = mvL = IF = maT = I
Conservation of Angular MomentumConsequence of T = dL/dt:If net torque is zero, angular momentum is unchangedResponsible for gyroscopes' unintuitive behaviourThe gyroscope is tipped overbut it doesnt fall
Moment of InertiaSaid that moment of inertia of a point particle is mr^2In the general case, I = r^2 dV where r is the distance perpendicular to the axis of rotationDon't know the axis of rotation beforehand
Moment of InertiaI = (x,y,z) dxdydz
y^2 + z^2-xy-xz-xyx^2 + z^2-yz-xz-yzx^2+y^2
Diagonalized Moment of InertiaLuckily, we can choose axes (principal axes of the body) so that the matrix simplifies:
I =
where, e.g., Ixx = m(y*y + z*z)Off-diagonal entries called "products of inertia"
Ixx000Iyy000Izz
Avoiding products of inertia Do calculations in inertial reference frame whose axes line up with the principal axes of your objectTransform the results into worldspaceMoment of inertia of a body fixed, so can be precomputed and used at run-time
Moment of InertiaIn general, the more compact a body is, the smaller the moments of inertia, and the faster it will spin (for the same torque)
Fake INot doing engineering simulation (prediction of how real objects will behave)Can invent I rather than integrating
Large values: hard to rotate about this axisAvoid off-diagonal elements
Fake constantsFor that matter, can fake lots of stuffDifferent gravity for different objectse.g., slow bullets in FPSe.g., fast falling in platformer
fake forces, approximate bounding geometry
Case in 2DIn 2D, the vectors T, , become scalars (their direction is known only magnitude is needed)Moment of inertia becomes a scalar too:I = prdA
Single planar rigid bodystate contains x, y, , vx, vy, HaveF = ma (2 equations)T = Ix = vx dty = vy dt = dtIntegrate to obtain new state, and proceed
Rigid body in 3DNeed some way to represent general orientationNeed to be able to compose changes in orientation efficiently
QuaternionsQuaternion: structure for representing rotationunit vector (axis of rotation)scalar (amount of rotation)recall, store (cos(/2), v sin(/2) )Can represent orientation as quaternion, by interpreting as rotation from canonical position
QuaternionsRotation of about axis v:q = (cos(/2), v sin(/2))"Unit quaternion": q.q = 1 (if v is a unit vector)Maintain unit quaternion by normalizing v
Arbitrary vector r can be written in quaternion form as (0, r)
Quaternion RotationTo 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-1p' = (0, r')r' is the rotated vector r
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 shownq(t) = [0, ] q(t)Summarize this q(t)Rotation Differentiation
Using quaternions givesRigid Body Equations of Motiond/dt=
x(t)q(t)P(t)L(t)
v(t) q(t)F(t)T(t)
P and LNote thatv = P/m (from P=mv) = I-1L (from L = I)
Often useful to use momentum variables as main variables, and only compute v and (auxiliary variables) as needed for the integration
ImpulseSudden change in momentumalso, angular momentum (impulsive torque)
Collision resolution using impulsenew angular momentum according to conditions of collisionalgorithmic means available for resolving