Animation and Games Development

Slides:



Advertisements
Similar presentations
AP Physics C Mechanics Review.
Advertisements

Physics: Laws of Motion Soon Tee Teoh CS 134. Newtons Laws of Motion First Law: When there is no net force on an object, its velocity would remain the.
Chapter 11 Angular Momentum
Chapter 4 Forces in One Dimension
Two-Dimensional Rotational Dynamics W09D2. Young and Freedman: 1
Newton’s Laws of Motion (and force!!) A force is a push or pull on an object.
Newton’s Laws of Motion
KINETICS of PARTICLES Newton’s 2nd Law & The Equation of Motion
Rotational Dynamics and Static Equilibrium. Torque From experience, we know that the same force will be much more effective at rotating an object such.
Dynamics of Rotational Motion
Chapter 8 Rotational Equilibrium and Rotational Dynamics.
Chapter 3 Biomechanics Concepts I
Chapter 8 Rotational Equilibrium and Rotational Dynamics.
Rotational Dynamics Chapter 9.
Dynamics of a Rigid Body
Semester Physics 1901 (Advanced) A/Prof Geraint F. Lewis Rm 560, A29
ISAAC NEWTON AND THE FORCE Dynamics. Kinematics vs Dynamics Kinematics – the study of how stuff move  Velocity, acceleration, displacement, vector analysis.
What is a force? How does friction affect motion?
Classical Mechanics Describes the relationship between the motion of objects in our everyday world and the forces acting on them Conditions when Classical.
Chapter 4 Forces and the Laws of Motion. Chapter Objectives Define force Identify different classes of forces Free Body Diagrams Newton’s Laws of Motion.
Honors Physics Semester 1 Review PowerPoint. Distance vs Displacement Distance = magnitude only = 8m Displacement = magnitude and.
Mechanics and Materials Forces Displacement Deformation (Strain) Translations and Rotations Stresses Material Properties.
Rotation and angular momentum
Spring Topic Outline for Physics 1 Spring 2011.
Lecture VII Rigid Body Dynamics CS274: Computer Animation and Simulation.
KINESIOLOGY دکترامیر هوشنگ واحدی متخصص طب فیزیکی و توانبخشی قسمت 3.
Game Physics – Part I Dan Fleck Coming up: Rigid Body Dynamics.
Give the expression for the velocity of an object rolling down an incline without slipping in terms of h (height), M(mass), g, I (Moment of inertia) and.
Newton’s 1 st Law of Mechanics A particle will continue is a straight line at constant speed unless acted upon by a net push or pull (i.e. force). The.
Forces and the Laws of Motion Chapter Changes in Motion Objectives  Describe how force affects the motion of an object  Interpret and construct.
JJ205 ENGINEERING MECHANICS COURSE LEARNING OUTCOMES : Upon completion of this course, students should be able to: CLO 1. apply the principles of statics.
Mechanics Topic 2.2 Forces and Dynamics. Forces and Free-body Diagrams To a physicist a force is recognised by the effect or effects that it produces.
1 Physics 1100 – Spring 2009 Review for Exam I Friday, February 27 th Chapters
 Large scale  Small scale  Fast vs. slow  Frame of reference?
STATICS AND DYNAMICS 4TH ESO Chemistry and Physics IES AMES.
Rotational Mechanics. Rotary Motion Rotation about internal axis (spinning) Rate of rotation can be constant or variable Use angular variables to describe.
Advanced Computer Graphics Rigid Body Simulation Spring 2002 Professor Brogan.
Chapter 4 The Laws of Motion. Classical Mechanics Describes the relationship between the motion of objects in our everyday world and the forces acting.
Motion and Forces Welcome to the Physics part of Physical Science.
Dynamics!.
Basic Information: Force: A push or pull on an object Forces can cause an object to: Speed up Slow down Change direction Basically, Forces can cause an.
Forces, The laws of Motion & Momentum.
AP Physics C Montwood High School R. Casao. When a wheel moves along a straight track, the center of the wheel moves forward in pure translation. A point.
CS274 Spring 01 Lecture 7 Copyright © Mark Meyer Lecture VII Rigid Body Dynamics CS274: Computer Animation and Simulation.
Force = a push or a pull Mrs. Clarici
Motion Motion Motion – Occurs when an object changes position relative to a reference point – Don’t have to see it move to motion took place.
Force and Motion The only reason an object changes it velocity is because a force acts on the object. Remember a change in velocity can be either a change.
Wednesday, Nov. 10, 2004PHYS , Fall 2004 Dr. Jaehoon Yu 1 1.Moment of Inertia 2.Parallel Axis Theorem 3.Torque and Angular Acceleration 4.Rotational.
Two-Dimensional Rotational Dynamics 8.01 W09D2 Young and Freedman: 1.10 (Vector Product), , 10.4, ;
Motion, Forces and Energy
Chapter 4 The Laws of Motion.
1 Chapter 2 Objectives: 1)Define and distinguish “scalar” from “vector.” 2)Define and differentiate “speed” and “velocity.” 3)Be able to apply the relationship.
Chapter 8 Lecture Pearson Physics Rotational Motion and Equilibrium Spring, 2016 © 2014 Pearson Education, Inc.
FORCE & MOTION. I. Force Definition – a push or pull Measured in Newtons (N) – by a spring scale.
1 Physics: Chapter 4 Forces & the Laws of Motion Topics:4-1 Changes in Motion 4-2 Newton’s First Law 4-3 Newton’s Second & Third Laws 4-4 Everyday Forces.
Engineering Mechanics Statics. Introduction Mechanics - the physical science which describes or predicts the conditions of rest or motion of bodies under.
UNIT 3 Dynamics 26 May 2018 Physics 11.
Section 1 Describing Motion
Lecture Rigid Body Dynamics.
Motion & Forces Unit 2.
Do now A baseball player holds a bat loosely and bunts a ball. Express your understanding of momentum conservation by filling in the tables below.
Forces.
By: Cassidy, Haig, Ali, Juliette, Jake, and Max
Dynamics: Newton’s Laws of Motion (Ch. 12)
BIOMECHANICS CONCEPTS
Forces and Newton’s Laws of Motion
Ch. 4 Forces and Motion PS2.
Motion and Forces.
AS-Level Maths: Mechanics 1 for Edexcel
Forces Force is a push or pull that is applied by one object on another. Force is measured in newtons (N). Two types of forces Contact and Non-contact.
Presentation transcript:

Animation and Games Development 242-515, Semester 1, 2014-2015 12. Basic Physics Objective show how physics is used in games programming

Overview 1. Why Physics? Point-based Physics Rigid Body Physics 4. Other Types of Force 5. The World of the Car 6. JBullet Features 7. A Game Physics Textbook

1. Why Physics? Physics can make game worlds appear more natural / realistic But... Often games are not realistic e.g. cars travelling at 200 mph, double jumps of Mario Physics engines are computationally expensive they may slow down the game too much

Engines Commercial Free Havok (Havok.com) Renderware (renderware.com) NovodeX (novodex.com) Free Open Dynamic Engine (ODE) (ode.org) PhysX Bullet (Java version used in jME) Box2D (2D)

Types of Physics Newtonian (this one for games) Classical Quantum Newton’s space and time are absolute Classical Einstein's space-time can be “changed” by matter Quantum Deterministic causality questioned and multiple localities in a single instance

Remember this stuff….. Time A measured duration Speed The distance travelled given some time limit Direction An indication of travel Velocity The rate of change of position over time (has speed and direction) Acceleration The rate of change of velocity Force Causes objects to accelerate (has direction as well as magnitude) Mass The weight of an object? (No! weight depends on gravitational pull) The quantity of matter

Newton’s First Law of Motion Every body (object) continues in its state of rest, or uniform motion in a straight line, unless there is an external force acting on it. Often called "The Law of Inertia"

Newton’s Second Law of Motion The rate of change of momentum of a body is proportional to the force acting on it, and takes place in the direction of that force. Simplified – An object’s change in velocity is proportional to an applied force. An object's mass m, its acceleration a, and the applied force F canbe represented by the formula: F = ma

Newton’s 3rd Law of Motion For every action there is an equal and opposite reaction. If two objects bump into each other they will react by moving apart.

As Cartoons

Game Physics Two main types of Newtonian physics used in games: point-based, rigid body based Point-based physics used in particle systems, bullet motion… a point's mass is located inside the point a point does not rotate: it has no rotational orientation

2. Point-based Physics Solve Newtonian equations to get the position of a point at time t: Force applied to the point, F(t), causes acceleration Acceleration, a(t), causes a change in the point's velocity Velocity, V(t) causes a change in the point's position

Calculation Examples Calculate a new position based on a constant velocity: xt = x0 + (vx * t) yt = y0 + (vy * t) zt = z0 + (vz * t) Velocity is a Vector, (vx, vy, vz), or (vx, vy) in 2D Example, point at (1, 5), velocity of (4, -3)

Standard Equations v = u + a t s = ½ t (u + v) v2 = u2 + 2 a s s = u t + ½ a t2 u = initial velocity; v = final velocity a = acceleration t = time (seconds) s = distance (meters)

Velocity Vtotal = √(Vx2 + Vy2 + Vz2) for 3D games Velocities are vectors: Vtotal = √(Vx2 + Vy2 + Vz2) for 3D games Vtotal = √(Vx2 + Vy2) for 2D games

Acceleration Calculate a new velocity (vt) based on a constant acceleration: vt = dx/dt = v0 + (a * dt) Each of these calculations are in one dimension you must perform similar calculations on y & z axes

Forces Forces are vectors Ftotal = √(Fx2 + Fy2 + Fz2) for 3D games Ftotal = √(Fx2 + Fy2) for 2D games

Example: 3D Projectile Motion Weight of the projectile (a point), W = mg g: constant acceleration due to gravity (9.81m/s2) Projectile equations of motion: Here, the terms on the right such as g(t-tinit) indicate multiplication by (t-tinit), rather than g being a function of (t-tinit). The perils of inconsistent and contradictory notation exist throughout math and science. See Chapter Zero in Jim Blinn’s book, Notation, Notation, Notation, for further enlightenment related to this fact! *IMPORTANT NOTE: The closed form equations are exact; HOWEVER, they are only exact when the gravitational field is truly uniform, acting in the same direction throughout the gravitational field. In real life, on real planets, this is not the case, since when you move across the surface the direction to the center of mass of the planet changes. (In real life acceleration due to gravity doesn’t even act exactly towards the center of the planet, since the mass distribution of the planet isn’t constant, and fluctuates ever so subtly). But, for objects moving relatively small distances over the surface of large planets, the assumption of constant g is quite accurate. For space craft simulation, where the distance from the object to planet center is much larger than the planet radius, the assumption of constant g breaks down and isn’t at all accurate. The next step up is to use a central force approximation and use conservation of angular momentum to model the orbital motion. Could also just calculate the force due to gravity based on the relative location of two masses, using Newton’s Law of Universal Gravitation (or something more exotic). p() is the position function

Target Practice Projectile Launch Position, pinit Target Under constant gravitional acceleration, projectile path is a parabola Target

3. Rigid Body Physics The shape (body) has a mass that occupies volume. We assume that the body never changes shape The orientation of the body can change over time.

Rigid Body Translation Good news: the maths of rigid body translation is the same as for points, since we can treat the center of mass of the body as a point. This means we can reuse the maths: F = m a v = ∫a dt x = ∫v dt momentum is conserved

center of mass = point

Rotation A rigid body has an orientation (rotated position in space) Rotation calculations are complicated one reason is that the order of rotation operations is important: x-axis rotation then y-axis rotation ≠ y-axis rotation then x-axis rotation Rotation is not commutative

When a body can rotate the Newtonian motion equations must be extended. new equations are needed for rotational (angular) mass, velocity, acceleration, force, momemtum, etc.

Angular Velocity, ω The angular velocity ω describes the speed of rotation and the orientation of the axis about which the rotation occurs.

Angular Velocity Again Δθ = change in angular displacement Δt = time

Angular Acceleration, α Δω = change in angular velocity Δt = time

Applying Force What happens when you push on a rotating body? There are two things to consider: translation and rotation. For translation, we can use F=ma, because the body's center of mass can be treated like a point. But how does the force affect the body's orientation?

Torque, T Torque is a measure of how much a force acting on an object causes that object to rotate. T = r x F = r F sin(θ) Torque is the cross product (x) between the distance vector from the pivot point (O) to the point where force vector F is applied θ is the angle between r and F

Uses for Torque The same amount of torque can be applied with less force if the distance from the pivot (fulcrum) is increased.

Moment of Inertia I Moment of inertia is the mass property of a rigid body that determines the torque needed for a desired angular acceleration about an axis of rotation. Moment of inertia depends on the shape of the body and may be different around different axes of rotation. shape effect

easy (torque is small) hard (torque is large) axes effect

Another definition: moment of Inertia is an object’s resistance to rotating around an axis

Linear Momentum, p Also called translational momentum: the product of the mass and velocity of an object p = m v Linear momentum is a conserved quantity: if a closed system is not affected by external forces, then its total linear momentum cannot change useful for calculating velocity change after collisions

Angular momentum, L Angular momentum is the rotational version of linear momentum. e.g. a tire rolling down a hill has angular momentum Defined as the cross product of the moment of inertia I and the angular velocity ω. L = l x ω

Angular momentum is a conserved quantity: if a closed system is not affected by external torque, then its total angular momentum cannot change useful for calculating rotational change when moments of inertia change L = I1 x ω1 L = I2 x ω2

Linear vs. Angular Linear Concept Angular Version velocity v angular velocity ω acceleration a angular acceleration α F = m a torque T = r x F' = I α mass m moment of inertia I momentum p = m v angular momentum L = I x ω

Changing Coordinate Systems The maths for rigid bodies is simpler if we use a local coordinate system for each body e.g. place the origin at the centre of mass of the body But, we also need to transform any global forces into each body's local coordinate system We also have to transform any local motion back into global coordinates.

4. Other Types of Force (Virtual) Springs Damping Friction Aerodynamic Drag …

(Virtual) Springs Even if you don't see very many actual springs in a game, there are likely to be many invisible virtual springs at work. Virtual springs are useful for implementing constraints between objects: preventing objects overlapping cloth rendering character animation

Linear Springs

Damping Damping describes physical conditions such as viscosity, roughness, etc.

Static Friction Not Sliding On the Brink Sliding

Kinetic Friction Once static friction is overcome and the object is moving, friction continues to push against the relative motion of the two surfaces. called kinetic friction

5. The World of the Car Cars exist in an environment that exerts forces.

Resistance A car driving down a road experiences two (main) types of resistance. Aerodynamic drag, rolling resistance Once resistance has been calculated, it is possible to calculate the amount of power a car needs to move.

Aerodynamic Drag Projected frontal area of car normal to direction of V Mass density of air Speed of car Drag coefficient: 0.29 – 0.4: sports cars; 0.6 – 0.9: trucks

Rolling resistance Tires rolling on a road experience rolling resistance. This is not friction and has a lot to do with wheel deformation. Simplifying, we can say: Coefficient of rolling resistance: Cars ≈ 0.015; trucks ≈ 0.006 – 0.01 Weight of car (assuming four identical wheels)

Power Power is the measure of the amount of work done by a force, or torque, over time. Mechanical work done by a force is equal to the force * distance an object moves under the action of that force. Power is usually expressed in units of horsepower 1 horsepower = 550 ft-lbs/s

Horsepower Horsepower needed to overcome total resistance at a given speed (we are working in feet and lbs): Total resistance corresponding to a car’s speed (V) horsepower

Engine output The previous equation relates the power delivered to the wheels to reach speed V. The actual power required will be higher due to mechanical loss. Power is delivered to a wheel in the form of torque. Force delivered by a wheel to the road to push the car along Torque on the wheel Radius of the wheel

Stopping Stopping distance depends on the braking system and how hard the driver breaks. the harder the brakes are applied the shorter the stopping distance If a car skids then the stopping distance depends on the frictional force between the tyres and the road. If travelling uphill the stopping distance will be shorter. gravity plays a role If travelling downhill the stopping distance will be greater.

Calculating Skidding Distance Initial speed of the car Acceleration due to gravity Angle of the road Coefficient of friction between wheels and the road. Usually around 0.4

More Calculations Required? In a real driving game a lot more parameters play a role. e.g. suspension, variable engine power, road surface Usually it is easier to use a physics engine, but this still requires an understanding of the forces that you want to model.

6. JBullet Features Rigid Bodies Joints and Spring Constraints Simple shapes, complex geometries Joints and Spring Constraints Dynamics Modeling Integrating forces and torques Collision Detection Physical interactions between objects Ray Tracing Range finders and optical flow Cloth, Soft (deformable) Bodies what we've been talking about in this part the next part

7. A Game Physics Textbook Physics for Game Developers David M Bourg, Bryan Bywalec O'Reilly, April 2013, 2nd ed.