48
Modelling Physics - Introduction Edmond C. Prakash [email protected]

Edmond physics modelling_2010

Embed Size (px)

DESCRIPTION

Physics

Citation preview

Page 1: Edmond physics modelling_2010

Modelling Physics - Introduction

Edmond C. [email protected]

Page 2: Edmond physics modelling_2010

Physics

We 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

Page 3: Edmond physics modelling_2010

Suppose we’d like to animate/simulate a hat flying through the air and landing on a coat-rack.

What do we need to know?

Why Physics in Modelling?

Page 4: Edmond physics modelling_2010

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

Page 5: Edmond physics modelling_2010

Illustration of Dynamics in AnimationRigid Body

Soft BodyArticulated Body

Page 6: Edmond physics modelling_2010

Physics - Part IProjectile Motion (Golf)

Page 7: Edmond physics modelling_2010

Overview

• Projectile – Examples

• Motion Types – Horizontal, Free Fall, Projectile

• Projectile Equations

• Maximum Height, Distance, Time

• Resistance

• Path of a Projectile in Games/Movies

Page 8: Edmond physics modelling_2010

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 that's physics in action.

• You throw anything, it is a projectile!!!

Page 9: Edmond physics modelling_2010

Horizontal, Free Fall & Projectile

Page 10: Edmond physics modelling_2010

A horizontal projectile has the same horizontal velocity throughout the fall, as it accelerates towards the surface, the combined effect resulting in a curved path. Neglecting air resistance, an arrow shot horizontally will strike the ground at the same time as one dropped from the same height above the ground, as shown here by the increasing vertical velocity arrows.

Page 11: Edmond physics modelling_2010

A ball is thrown at some angle to the horizon when it is passed downfield. Neglecting air resistance, the horizontal velocity is a constant, and the vertical velocity decreases, then increases, just as in the case if a vertical projectile. The combined motion produces a parabolic path.

Page 12: Edmond physics modelling_2010

Without a doubt, this baseball player is aware of the relationship between the projection angle and the maximum distance acquired for a given projection velocity.

Page 13: Edmond physics modelling_2010

Projectile Game Hit target without hitting the building!

Page 14: Edmond physics modelling_2010

Wind ResistanceNo longer a parabola

Page 15: Edmond physics modelling_2010

Path of Projectile• X = x + Vx + W

• Y = y + Vy

• Vxi = cos() * Vi

• Vyi = sin() * Vi

• Vx = Vx - WR(Vx)

• Vy = Vy - WR(Vy) + G

• W = wind

• A = inclination angle

• Vi = initial velocity

• WR = wind resistance

• G = gravity

Page 16: Edmond physics modelling_2010

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?

Page 17: Edmond physics modelling_2010

Modelling Physics

Part II: Friction

Friction• Static, • Sliding & • Tipping

Page 18: Edmond physics modelling_2010

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

Page 19: Edmond physics modelling_2010

m Fpush

FS

w = m.g

N = - m.g

v = 0

Static Friction

Page 20: Edmond physics modelling_2010

Fpush

m Fpush

FK

w = m.g

N = - m.g

v > 0

Kinetic Friction

Page 21: Edmond physics modelling_2010

m Fpush

FS

w = m.g

N = - m.g

m Fpush

FK

w = m.g

N = - m.g

v = 0

v > 0

Static vs. Kinetic Friction

Page 22: Edmond physics modelling_2010

Static Friction

• Prevents an object on a surface from moving by opposing any tangential force that may be acting on it.

NF SS

Normal force

Coefficient of Static Friction

Direction opposite to any force trying to move the object

Force of an object > MAX value of FS :• Object begins to move• Static friction force is replaced by kinetic friction force FK

Page 23: Edmond physics modelling_2010

Surfaces

Aluminum on aluminum 1.1

Aluminum on steel 0.61

Copper on steel 0.53

Steel on steel 0.74

Nickel on nickel 1.1

Glass on glass 0.94

Copper on glass 0.68

Oak on oak (parallel to grain) 0.62

Oak on oak (perpendicular to grain) 0.54

Rubber on concrete (dry) 1.0

Rubber on concrete (wet) 0.3

S

Page 24: Edmond physics modelling_2010

Forces resisting motion of one object sliding across the surface of another object

• Very complex

• Good approximation Kinetic Frictional Force:

NF KK Normal component of the force by which the object is bound to the surface (usually gravity)

Coefficient of Kinetic Friction

Kinetic friction force always acts in the direction opposite that in which an object is moving across a surface

Page 25: Edmond physics modelling_2010

Coefficient of static friction = 0.5

By what angle does the plane need to be inclined before the block begins sliding under the influence of gravity?

cossin Nmg S

01 6.26tan S

Block Sliding m

θ

θ

w = m.g

m.g.cosθm.g.sinθ

-N µk

Page 26: Edmond physics modelling_2010

Surfaces

Aluminum on aluminum 1.4

Aluminum on steel 0.47

Copper on steel 0.36

Steel on steel 0.57

Nickel on nickel 0.53

Glass on glass 0.40

Copper on glass 0.53

Oak on oak (parallel to grain) 0.48

Oak on oak (perpendicular to grain) 0.32

Rubber on concrete (dry) 0.90

Rubber on concrete (wet) 0.25

K

Page 27: Edmond physics modelling_2010

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.

Page 28: Edmond physics modelling_2010

Part II : Friction (Summary)

Friction– Static– Kinetic (sliding objects)– Sliding on inclined plane (angle)– Tipping– Coefficient of friction

Page 29: Edmond physics modelling_2010

Modelling Physics

Part III : A Pool Game (Billiards/Snooker)

Overview – Input– Physics (Collision Response)

• Single/Multiple Reflection,

• Multiple collisions, Torque, Elasticity

– Output (Realistic Rendering)

Page 30: Edmond physics modelling_2010
Page 31: Edmond physics modelling_2010

Pool - Objects

1. 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?

2. What type of object movements happen in a pool game?

- cue, ball

4. Background object movements?

characters, background objects

Page 32: Edmond physics modelling_2010

Collisions

1. What types of object collisions happen in the pool game?

- cue-ball, ball-ball, ball-rail

2. Any background object collisions?

ball jumps off the table, game players with table, placing the hand on the table

Page 33: Edmond physics modelling_2010

Collision Tests

1. 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

Page 34: Edmond physics modelling_2010

Single/Multiple Reflections

Page 35: Edmond physics modelling_2010

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?

Page 36: Edmond physics modelling_2010

Collision along a straight line!

• Cue-ball• Ball-ball• Ball-rail

A

impulse

A is stationary

direction of B

impulse

direction of A

direction of B

A

BB

Page 37: Edmond physics modelling_2010

Collision along a straight line!

• Cue-ball• Ball-ball• Ball-rail

impulse

initialdirection of A

A

B

finaldirection of A

initialdirection of B

finaldirection of B

initialdirection of A

initialdirection of B

B

A

Page 38: Edmond physics modelling_2010

Cue hits ball – offset (1)

• Torque is extremely important to a pool player. • Torque is the rotational analog of force. • When you apply a net torque, you change an object's angular momentum.• Torque is measured by taking the radius and multiplying it by the force perpendicular to the radius (T = R x F).

impulsedue to inertia

hit on leftby cue

F

R

R

Page 39: Edmond physics modelling_2010

Physics - multiple simultaneous collisions

A B C D

A BC

D

Page 40: Edmond physics modelling_2010

Friction: Rotational Velocity

1. Ball stops after a while.2. The friction of the cloth will put forward, never backward, roll on the ball.

fk fs

Page 41: Edmond physics modelling_2010

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.

Page 42: Edmond physics modelling_2010

Pool Rendering

• Realistic Rendering of Objects– Table– Cloth– Hand– Cue– Balls– Characters – Background (Window/Walls)

Page 43: Edmond physics modelling_2010

Rendering

Page 44: Edmond physics modelling_2010

Part III: Pool Physics (Summary)

• Input for the Pool Game• Simulation – Physics

– linear velocity– angular velocity– torque– friction– collision detection– collision response

• Output

Page 45: Edmond physics modelling_2010

Modelling Physics - Conclusion

• Part I: Projectile Motion (Golf)

• Part II : Friction• Part III: Pool Physics

Page 46: Edmond physics modelling_2010

Demos

• Missiles– BattleField2 x 2

– Cannon Catch/ Cannon Sheet

• Friction– Car Physics

• Havok Examples– Fall guy

– Chess pieces

• Pool Physics

• Unreal Engine 3– Meat

– Blob

Page 47: Edmond physics modelling_2010

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, O'Reilly & 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

Page 48: Edmond physics modelling_2010

Physics Engines• Ageia PhysX™ Physics Engine (Free Binary)

• Havok (Free Educational)• Bullet 3D Game Multiphysics Library (Open

Source) http://bulletphysics.com