Edmond physics modelling_2010

Preview:

DESCRIPTION

Physics

Citation preview

Modelling Physics - Introduction

Edmond C. PrakashE.Prakash@beds.ac.uk

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

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?

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 in AnimationRigid Body

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

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

Horizontal, Free Fall & Projectile

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.

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.

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.

Projectile Game Hit target without hitting the building!

Wind ResistanceNo longer a parabola

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

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?

Modelling Physics

Part II: Friction

Friction• Static, • Sliding & • Tipping

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

m Fpush

FS

w = m.g

N = - m.g

v = 0

Static Friction

Fpush

m Fpush

FK

w = m.g

N = - m.g

v > 0

Kinetic Friction

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

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

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

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

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

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

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

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

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

Single/Multiple Reflections

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

impulse

A is stationary

direction of B

impulse

direction of A

direction of B

A

BB

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

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

Physics - multiple simultaneous collisions

A B C D

A BC

D

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

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)

Rendering

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– BattleField2 x 2

– Cannon Catch/ Cannon Sheet

• Friction– Car Physics

• Havok Examples– Fall guy

– Chess pieces

• Pool 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, 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

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

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

Source) http://bulletphysics.com