Modelling Physics - Introduction Edmond C. Prakash E.Prakash@beds.ac.uk
PhysicsWe have studied physics before:• Illumination (Laws of Optics & Light from Physics)• Collision Detection (no inter-penetration)• Water/Atmosphere• Character – Physical Joint Constraints• IK – Physical Movement Control
Why Physics in Modelling?Suppose we’d like to animate/simulate a hat flyingthrough the air and landing on a coat-rack.What do we need to know?
Modelling Physics• Not trying to build a perfect physical model• Most things can be approximated assuming Newtonian physics and rigid bodies• Use discrete simulation (constant step) techniques• Just worry about center of mass for most things
Illustration of Dynamics inRigid BodySoft Body AnimationArticulated Body
Physics - Part IProjectile Motion (Golf)
Overview• Projectile – Examples• Motion Types – Horizontal, Free Fall, Projectile• Projectile Equations• Maximum Height, Distance, Time• Resistance• Path of a Projectile in Games/Movies
Projectile Motion - Examples• Golf, Tennis, baseball, racket ball, footballs, soccer balls, shot put, etc.• Giving the ball a high velocity often leads to greater success. Now thats physics in action.• You throw anything, it is a projectile!!!
Horizontal, Free Fall & Projectile
A horizontal projectile has the same horizontal velocitythroughout the fall, as it accelerates towards the surface, thecombined effect resulting in a curved path. Neglecting airresistance, an arrow shot horizontally will strike the ground atthe same time as one dropped from the same height above theground, as shown here by the increasing vertical velocityarrows.
A ball is thrownat some angle to thehorizon when it ispassed downfield.Neglecting airresistance, thehorizontal velocityis a constant, andthe vertical velocity decreases, then increases, just as inthe case if a vertical projectile. The combined motionproduces a parabolic path.
Without a doubt, thisbaseball player is awareof the relationshipbetween the projectionangle and the maximumdistance acquired for agiven projectionvelocity.
Projectile GameHit target without hitting the building!
Wind Resistance No longer a parabola
• X = x + Vx + W Path of Projectile• Y = y + Vy • W = wind• Vxi = cos(θ) * Vi • A = inclination angle• Vyi = sin(θ) * Vi • Vi = initial velocity• Vx = Vx - WR(Vx) • WR = wind resistance• Vy = Vy - WR(Vy) + G • G = gravity
Part I: Projectiles (Summary)• Projectile Overview – Trajectory – Maximum height – Maximum distance – Total time• Projectiles - Special Scenarios – Mass – Wind – Wind resistance – Gravity (eg. moon or earth) – Source & target (Horizontal plane or different heights) – Obstacles (eg. Tall Buildings, mountains)• Projectiles – New Applications?
Friction• Two surfaces in contact.• Static – Holds a stationary object in place when in contact with another surface• Kinetic (or dynamic) – Surfaces in motion – Resisting that motion
Static Friction N = - m.g v=0 FS m Fpush w = m.g
Kinetic Friction Fpush N = - m.g v>0 FK m Fpush w = m.g
Static vs. Kinetic Friction N = - m.g v=0 FS m Fpush w = m.g N = - m.g v>0 FK m Fpush w = m.g
Static Friction• Prevents an object on a surface from moving by opposing any tangential force that may be acting on it. FS = −µ S NDirection opposite to any force Normal forcetrying to move the object Coefficient of Static Friction Force of an object > MAX value of FS : • Object begins to move • Static friction force is replaced by kinetic friction force FK
Surfaces µSAluminum on aluminum 1.1Aluminum on steel 0.61Copper on steel 0.53Steel on steel 0.74Nickel on nickel 1.1Glass on glass 0.94Copper on glass 0.68Oak on oak (parallel to grain) 0.62Oak on oak (perpendicular to grain) 0.54Rubber on concrete (dry) 1.0Rubber on concrete (wet) 0.3
Forces resisting motion of one object sliding across the surface of another object • Very complex • Good approximation Kinetic Frictional Force: FK = −µ K NKinetic friction force always Normal component of theacts in the direction opposite force by which the objectthat in which an object is is bound to the surfacemoving across a surface (usually gravity) Coefficient of Kinetic Friction
Block Sliding -N µk m m.g.sinθ m.g.cosθ θ w = m.g θCoefficient of static friction = 0.5By what angle does the plane need to be inclined before the blockbegins sliding under the influence of gravity? mg sin θ = µ S N cos θ −1 0 θ = tan µ S = 26.6
Surfaces µKAluminum on aluminum 1.4Aluminum on steel 0.47Copper on steel 0.36Steel on steel 0.57Nickel on nickel 0.53Glass on glass 0.40Copper on glass 0.53Oak on oak (parallel to grain) 0.48Oak on oak (perpendicular to grain) 0.32Rubber on concrete (dry) 0.90Rubber on concrete (wet) 0.25
Tipping• The 3D character pushes the box around by applying a horizontal force to the objects.• Without friction the box will slide forever.• If your point of contact is near the top of the box, the box will sometimes tip over before it starts sliding.
Part II : Friction (Summary)Friction– Static– Kinetic (sliding objects)– Sliding on inclined plane (angle)– Tipping– Coefficient of friction
Modelling Physics Part III : A Pool Game (Billiards/Snooker)Overview – Input – Physics (Collision Response) • Single/Multiple Reflection, • Multiple collisions, Torque, Elasticity – Output (Realistic Rendering)
Pool - Objects1. What type of objects do we have in a pool game? • Does the pool have to be a rectangle always? • Is it a 3-ball, 9-ball or n-ball game?1. What type of object movements happen in a pool game? - cue, ball4. Background object movements? characters, background objects
Collisions1. What types of object collisions happen in the pool game? - cue-ball, ball-ball, ball-rail2. Any background object collisions? ball jumps off the table, game players with table, placing the hand on the table
Collision Tests1. What types of object collision tests do we need to implement? We need to compute the point of contact: cue-ball: ray-sphere ball-ball: sphere-sphere ball-rail: sphere-plane
Collision Response• What type of collision response is required? – Cue-ball: if it is along the center, move cue-ball along the ray – cue-ball: if it is not along the center, deflect the ball. – ball-ball: Use simple reflection (90 degrees) – Are more complex movements possible?
Collision along a straight line! • Cue-ball • Ball-ball • Ball-rail A A is stationary A direction of A direction of B direction of Bimpulse impulse B B
Collision along a straight line! • Cue-ball • Ball-ball • Ball-railinitial final initialdirection direction directionof A of A of A A Aimpulsefinal B initial B initialdirection direction directionof B of B of B
Cue hits ball – offset (1)• Torque is extremely important to a pool player.• Torque is the rotational analog of force. R• When you apply a net torque, you change an objects angular momentum.• Torque is measured by taking the radius and multiplying it by the force perpendicular to the radius (T = R x F). F R hit on left by cue impulse due to inertia
Physics - multiple simultaneous collisions A B C D C A B D
Friction: Rotational Velocity1. Ball stops after a while.2. The friction of the cloth will put forward, never backward, roll on the ball. fk fs
ElasticityThe law of reflection can only be used in billiards to approximate the angle of reflection of a billiard ball. Since the rails of a pool table are rubber, the ball will sink into the cushion to varying degrees depending on the velocity of the ball. This amount that a ball sinks into the cushion changes the angle of reflection. For instance, the faster a ball is moving when it hits the rail, the sharper the angle of reflection will be. The law of reflection is a close approximation only if the ball is moving relatively slowly. The other factor that affects the angle of reflection is the spin on a ball.Yes. It is true that the law of reflection is only an approximation of what really happened! The effect of rubber and the spinning effect can also be simulated if we know the spring constant and apply conservation of momentum, energy and angular momentum.
Pool Rendering• Realistic Rendering of Objects – Table – Cloth – Hand – Cue – Balls – Characters – Background (Window/Walls)
Part III: Pool Physics (Summary)• Input for the Pool Game• Simulation – Physics – linear velocity – angular velocity – torque – friction – collision detection – collision response• Output
Modelling Physics - Conclusion• Part I: Projectile Motion (Golf)• Part II : Friction• Part III: Pool Physics
Demos• Missiles • Havok Examples – BattleField2 x 2 – Fall guy – Cannon Catch/ Cannon – Chess pieces Sheet• Friction • Pool Physics – Car Physics • Unreal Engine 3 – Meat – Blob
Realtime Physics – Books/Articles• Ian Millington, Game Physics – Engine Development, Morgan Kaufman, 2007.• Wendy Stahler, Fundamentals of Math and Physics for Game Programmers, Prentice Hall, 2006.• Christopher D. Watkins , Applied Physics for Game Programmers: Creating Real-time Simulations, Charles River Media, 2004.• David H. Eberly, Game Physics, Morgan Kaufmann, 2004.• David M. Bourg, Physics for Game Developers, OReilly & Associates, 2003.• Norman Lin, 3D Game Physics, Wordware Publishing, 2003.• Jeff Lander, Trials and Tribulations of Tribology, Gamasutra, www.gamasutra.com, 1998.Realtime Physics vs. Realistic Physics
Physics Engines• Ageia PhysX™ Physics Engine (Free Binary)• Havok (Free Educational)• Bullet 3D Game Multiphysics Library (Open Source) http://bulletphysics.com