Game Physics. Game and Media Technology Master Program - Utrecht University. Dr. Nicolas Pronost

Similar documents
Lecture I: Basic Physics

Rotational & Rigid-Body Mechanics. Lectures 3+4

Chapter 8- Rotational Motion

Chapter 10. Rotation of a Rigid Object about a Fixed Axis

The... of a particle is defined as its change in position in some time interval.

Dynamics. Dynamics of mechanical particle and particle systems (many body systems)

= o + t = ot + ½ t 2 = o + 2

Quantitative Skills in AP Physics 1

Lecture 13 REVIEW. Physics 106 Spring What should we know? What should we know? Newton s Laws

Preparing for Six Flags Physics Concepts

Chapter 8 Lecture Notes

Axis Balanced Forces Centripetal force. Change in velocity Circular Motion Circular orbit Collision. Conservation of Energy

CIRCULAR MOTION, HARMONIC MOTION, ROTATIONAL MOTION

Motion in Space. MATH 311, Calculus III. J. Robert Buchanan. Fall Department of Mathematics. J. Robert Buchanan Motion in Space

Chapter 8: Momentum, Impulse, & Collisions. Newton s second law in terms of momentum:

Mechanics. Time (s) Distance (m) Velocity (m/s) Acceleration (m/s 2 ) = + displacement/time.

1 2 Models, Theories, and Laws 1.5 Distinguish between models, theories, and laws 2.1 State the origin of significant figures in measurement

CIRCULAR MOTION AND ROTATION

Physics I. Unit 1 Methods in Science (Systems of Units) Competencies (Do) Students should be able to demonstrate scientific methods.

UNIVERSITY OF SASKATCHEWAN Department of Physics and Engineering Physics

24/06/13 Forces ( F.Robilliard) 1


particle p = m v F ext = d P = M d v cm dt

1 Forces. 2 Energy & Work. GS 104, Exam II Review

Pleeeeeeeeeeeeeease mark your UFID, exam number, and name correctly. 20 problems 3 problems from exam 2

4) Vector = and vector = What is vector = +? A) B) C) D) E)

Today s lecture. WEST VIRGINIA UNIVERSITY Physics

Lecture II: Rigid-Body Physics

3. Kinetics of Particles

Uniform circular motion (UCM) is the motion of an object in a perfect circle with a constant or uniform speed.

PHYS 1114, Lecture 33, April 10 Contents:

Honors Physics Review

r CM = ir im i i m i m i v i (2) P = i

Physics 12. Unit 5 Circular Motion and Gravitation Part 1

Rotational Kinematics and Dynamics. UCVTS AIT Physics

Collision Resolution

z F 3 = = = m 1 F 1 m 2 F 2 m 3 - Linear Momentum dp dt F net = d P net = d p 1 dt d p n dt - Conservation of Linear Momentum Δ P = 0

Game Physics. Game and Media Technology Master Program - Utrecht University. Dr. Nicolas Pronost

Chapter 8 Lecture. Pearson Physics. Rotational Motion and Equilibrium. Prepared by Chris Chiaverina Pearson Education, Inc.

Lecture 3. Rotational motion and Oscillation 06 September 2018

Circular Motion, Pt 2: Angular Dynamics. Mr. Velazquez AP/Honors Physics

We define angular displacement, θ, and angular velocity, ω. What's a radian?

Rotational Motion About a Fixed Axis

Uniform Circular Motion

2007 Problem Topic Comment 1 Kinematics Position-time equation Kinematics 7 2 Kinematics Velocity-time graph Dynamics 6 3 Kinematics Average velocity

Distance travelled time taken and if the particle is a distance s(t) along the x-axis, then its instantaneous speed is:

Lecture PowerPoints. Chapter 10 Physics for Scientists and Engineers, with Modern Physics, 4 th edition Giancoli

Translational vs Rotational. m x. Connection Δ = = = = = = Δ = = = = = = Δ =Δ = = = = = 2 / 1/2. Work

Physics Curriculum Guide for High School SDP Science Teachers

4. Find the average velocities and average accelerations of a particle moving in 1-D given its position at various times.

Torque and Rotation Lecture 7

l Every object in a state of uniform motion tends to remain in that state of motion unless an

HSC PHYSICS ONLINE B F BA. repulsion between two negatively charged objects. attraction between a negative charge and a positive charge

Translational Motion Rotational Motion Equations Sheet

Modeling Mechanical Systems

Oscillations. Oscillations and Simple Harmonic Motion

Motion. Argument: (i) Forces are needed to keep things moving, because they stop when the forces are taken away (evidence horse pulling a carriage).

Solutions to Exam #1

Rotation. Rotational Variables

Game Physics: Basic Concepts

AP Physics C Mechanics Objectives

Topic 1: Newtonian Mechanics Energy & Momentum

Physics 101 Final Exam Problem Guide

Physics Semester 2 Final Exam Review Answers

Big Idea 4: Interactions between systems can result in changes in those systems. Essential Knowledge 4.D.1: Torque, angular velocity, angular

Energy Conservation AP

Linear vs. Rotational Motion

Wiley Plus. Final Assignment (5) Is Due Today: Before 11 pm!

AP Physics C Summer Assignment Kinematics

Broward County Schools AP Physics 1 Review

Chapter 15 Periodic Motion

Announcements. 1. Do not bring the yellow equation sheets to the miderm. Idential sheets will be attached to the problems.

UNITS AND DEFINITIONS RELATED TO BIOMECHANICAL AND ELECTROMYOGRAPHICAL MEASUREMENTS

Lecture 18. In other words, if you double the stress, you double the resulting strain.

Acceleration in Uniform Circular Motion

Mechanics Topic B (Momentum) - 1 David Apsley

KINETIC AND POTENTIAL ENERGY. Chapter 6 (cont.)

Periodic Motion. Circular Motion, Gravity, Simple Harmonic Motion

Consider the case of a 100 N. mass on a horizontal surface as shown below:

Chapter 10 Momentum, System of Particles, and Conservation of Momentum

Kinematics (special case) Dynamics gravity, tension, elastic, normal, friction. Energy: kinetic, potential gravity, spring + work (friction)

Scaler Quantity (definition and examples) Average speed. (definition and examples)

Mechanics II. Which of the following relations among the forces W, k, N, and F must be true?

Oscillatory Motion SHM

Angle recap. Angular position: Angular displacement: s. Angular velocity: Angular Acceleration:

Final Exam April 30, 2013

DEVIL PHYSICS BADDEST CLASS ON CAMPUS IB PHYSICS

AP Physics C 2015 Summer Assignment

FIGURE 2. Total Acceleration The direction of the total acceleration of a rotating object can be found using the inverse tangent function.

AP Physics 1. Course Overview

PHYSICS. Chapter 9 Lecture FOR SCIENTISTS AND ENGINEERS A STRATEGIC APPROACH 4/E RANDALL D. KNIGHT Pearson Education, Inc.

PLANAR KINETIC EQUATIONS OF MOTION (Section 17.2)

Chapter 11. Angular Momentum

PES Physics 1 Practice Questions Exam 2. Name: Score: /...

Final Exam. June 10, 2008, 1:00pm

Exam II: Solutions. UNIVERSITY OF ALABAMA Department of Physics and Astronomy. PH 125 / LeClair Spring 2009

MOTION & FORCES. Observing Motion. Speed and Velocity. Distance vs. Displacement CHAPTERS 11 & 12

Chapters 10 & 11: Rotational Dynamics Thursday March 8 th

Physics for Scientists and Engineers 4th Edition, 2017

Subject: Triple Physics Unit title: P4.5 Forces (Paper 2) Strand Content Checklist (L) R A G Forces and their interactions

Transcription:

Game and Media Technology Master Program - Utrecht University Dr. Nicolas Pronost

Essential physics for game developers

Introduction

The primary issues Let s move virtual objects Kinematics: description of the motion consider position, velocity and acceleration Physics: the effect of forces on motion consider mass, inertia and more With physics, objects can interact through forces No need to precompute/script motions/interactions React natively according to (implemented) physics laws Good for games! 4

The primary issues How do I control the forces to achieve an effect? When objects can move, they can also collide Collision detection: did a collision occur and where? Collision resolution: what do we do? 5

We can use physics to simulate rigid bodies Applications mechanically considered as points possibly connected to other bodies soft bodies can deform in a continuum possibly interacting with other bodies breakable bodies acting as single rigid bodies until some events break them into multiple ones 6

In solid body mechanics, an object is represented by a point in space Centroid of the object Modeling objects average of all locations describing the object Center of mass of the object weighted average of density, same as centroid if uniform In soft body mechanics, an object is represented by a structured set of points in space The geometry/boundary of an object is used in the collision detection and resolution, not in the mechanics 7

We need some basic math knowledge Point Vector magnitude, normalization, addition, subtraction, scalar multiplication, transpose, dot product, cross product... implicit and parametric representations, orthonormal basis... Matrix addition, subtraction, multiplication, transpose, dot product, inverse, rank, determinant... linear and affine transformation, homogeneous coordinate... Derivative and integral SI units Prerequisites 8

Kinematics

Kinematics To determine the object position p o at time t Suppose we have a constant velocity v Then p o t + t = p o t + v t Alternatively, p o = p o t + t p o t = v t If p o 0 = P, then p o t = P + vt So we could calculate the object position at any time But v is probably not constant over time The velocity is a function of the time v(t) responding to s external forces applied, so p o s = P + v t dt 0 The position has to be calculated regularly according to the (change in) velocity 10

Kinematics Similar properties hold for acceleration a If constant acceleration, then v = a t If not (probably), then v s = V + a t dt 0 But do we really need to integrate? If we recalculate the position at each game loop called after t And we assume velocity and acceleration were constant in that time interval (typically very short, around few milliseconds or less) Then we can use the formulas p o t + t = p o t + v t and v t + t = v t + a t s 11

Equations of motion 1.1-1.5 From this we can derive the following equations v(t + t) = v(t) + a t v = v(t + t) + v(t) 2 p o = 1 2 v(t + t) + v(t) t p o = v(t) t + 1 2 a t2 v(t + t) 2 = v(t) 2 + 2a p o 12

Physics-based system

Forces In a physics game engine what cause motion are not (change in) velocities or accelerations but forces The sum of all forces acting on an object determines how it moves The notation F will be used in place of F, but the context indicates if it is a scalar or a vector 14

Newton s laws of motion In the late 17 th century, Sir Isaac Newton described three laws that govern all motion on Earth 15

First Law of Motion Newton's first law specifies what happens when the net force on an object is null: all the individual forces cancel each other out, there should be no change in the motion If F net = 0, there is no change in motion It means that, until a non-zero net force is applied an object at rest stays at rest an moving object continues to move at the same speed in the same direction 16

Newton s second law of motion describes how an object moves when the net force is not zero It also shows that Second Law of Motion F net = m a where m is the mass and a the acceleration the more force is applied, the faster the object speeds up for an equal amount of force, lighter objects speed up faster than heavier objects 17

Third Law of Motion Newton s third law of motion describes the relationship between forces For every force there is an equal and opposite force, or, when two objects come into contact they exert equal and opposite forces upon each other 18

Forces

Gravity Newton s Law of Gravitation states that the gravitation force between two masses A and B is proportional to the product of the masses m A and m B inversely proportional to the square of the distance between the two masses acting on the line connecting the two masses F g = F A B = F B A = G m Am B r 2 u AB where G is the gravitational constant 6.673 10 11 m 3 kg 1 s 2, r is the distance between the two masses and u AB the unit distance vector 20

By applying Newton s second law to an object with mass m on the surface of the Earth we obtain F net = F g = m a G m m Earth r Earth 2 G m Earth r Earth 2 = a = m a a = 6.673 10 Gravity on Earth 11 5.98 1024 6.377 10 6 2 = 9.81 m/s2 21

Other gravity On Earth at altitude h: a = G On the Moon m moon = 7.35 10 22 kg r moon = 1738 km g moon = 1.62 m/s 2 On Mars m mars = 6.42 10 23 kg r mars = 3403 km g mars = 3.69 m/s 2 m Earth r Earth +h 2 22

Weight Other name for the gravitation force 1.6-1.9 W = m g where m is the mass of the object and g the acceleration due to gravity We note that force unit is kg m/s 2, noted as Newtons (N) 23

Normal force Force acting as a reaction to a contact Direction normal to the surface of contact Magnitude equals to the incoming force projected on the normal direction 1.10 α Here, F N = W cos(α) Related to collision handling (more later) 24

What about the tangential component of the reaction to contact? Here, the W sin(α) Friction Energy is conserved, so where does it go? In the friction force, i.e. ability to resist movement Static friction keeps an object on a surface from moving Kinetic friction slows down an object in contact 25

Friction If added up forces are less than the static friction then the object will not move As soon as the object starts moving (because forces are higher than static friction), then the kinetic friction takes over Both friction forces depend on the two surfaces coming in contact the smoother the surfaces, the less friction defined by a coefficient of friction μ, the ratio of the force of friction between two bodies and the force pressing them together 26

Friction Surface Friction Static (μ s ) Kinetic (μ k ) Steel on steel (dry) 0.6 0.4 Steel on steel (greasy) 0.1 0.05 Teflon on steel 0.041 0.04 Brake lining on cast iron 0.4 0.3 Rubber on concrete (dry) 1.0 0.9 Rubber on concrete (wet) 0.30 0.25 Metal on ice 0.022 0.02 Steel on steel 0.74 0.57 Aluminum on steel 0.61 0.47 Copper on steel 0.53 0.36 Nickel on nickel 1.1 0.53 Glass on glass 0.94 0.40 Copper on glass 0.68 0.53 27

Friction Friction forces are calculated from these coefficients 1.11-1.12 Static friction: F s = μ s F N Kinetic friction: F k = μ k F N The kinetic coefficient of friction is always smaller than the static coefficient of friction If the tangential force is larger than the static friction, the object moves If the object moves while in contact, the kinetic friction is applied to the object 28

Fluid resistance An object moving in a fluid (air is a fluid) is slowed down by this fluid This is called fluid resistance or drag and depends on several parameters e.g. the faster the object, the larger resistance e.g. the more exposed surface, the larger resistance 29

Fluid resistance At high velocity, the drag force F D high to the relative velocity of the object v is quadratic F Dhigh = 1 2 ρ v2 C d A where ρ is the density of the fluid (1.204 for air at 20 ), C d is the drag coefficient (depends on the shape of the object) and A is the reference area (area of the projection of the exposed shape) 30

Fluid resistance At low velocity, the drag force is considered linearly proportional to the velocity 1.13 F Dlow = b v where b depends on the properties of the fluid and the shape of the object High/low velocity threshold is defined by Reynolds Number (Re) Approximation of real physics, just good for games 31

Buoyancy The buoyancy is the force that develops when an object is immersed in a fluid It is a function of the volume of the object V and the density of the fluid ρ F B = ρ g V It comes from the difference of pressure above and below the immerged object and is directed straight up, counteracting the weight of the object 1.14 32

Springs Springs are used to connect two or more objects They react according to Hook s Law on extension and compression, i.e. on the relative displacement between the connected objects The relative length l to the rest-length l 0 determines the force to apply F s = K l l 0 where K is the spring constant (in N/m) 33

Dampers Dampers try to slow down the motion between two objects A and B connected by a spring (reduce amplitude of oscillation) The damping force depends on the relative speed between the two objects F C = C(v A v B ) where C is the damping coefficient and the resulting force applied on A (opposite on B) Similar to drag force at low velocity! 34

Free Body Diagram Once you have all the forces acting on an object, you have to sum them up and divide them by the mass of the object to obtain the acceleration F net = m a To help you to analyze the forces, you can use a pictorial device, called Free Body Diagram that includes the shape of the object, its center of mass and contact points the external forces with direction, magnitude and point of application 35

Energy-based system

Work The work W (in Joule = N m) is defined as the amount of displacement p o of an object times the net force F applied on the object in the direction of the displacement W = F p o α F F cos α 37

Kinetic energy The kinetic energy E K is the amount of energy an object has from moving E K = 1 2 m v2 where m is the mass of the object and v its speed the faster the object is moving, the more energy it has the energy is a scalar (that s why speed is used and not velocity) unit is also Joule as kg(m/s) 2 = kg m s2 m = N m = J 38

Work-Energy theorem The Work-Energy theorem states that the net work of an object is equal to the change in its kinetic energy W = E K = E K (t + t) E K (t) i.e. F p o = 1 2 m v(t + t)2 v(t) 2 1.15 We can notice that if a work exists, the object either speeds up or slows down (difference of velocities not null) Very similar to Newton s second law... 39

Potential energy (Gravitational) Potential energy is the energy stored in an object due to its height off the ground E P = m g h Simple product of the weight W = m g and height h Also measured in Joules (as here kg m s 2 m) Other potential energies exist but are insignificant in game physics 40

Conservation of mechanical energy The law of conservation of mechanical energy states that the energy of an object cannot be created or destroyed but can switch forms, including the two we just described E K (t + t) + E P (t + t) = E K (t) + E P (t) i.e. 1 2 mv(t + t)2 + mgh t + t = 1 2 mv(t)2 + mgh t 41

Conservation of mechanical energy Picture a roller coaster cart at the top of the first hill It has a lot of potential energy but only a little bit of kinetic energy Then it goes down the first big drop, and as it loses height, the cart picks up speed By the time it gets down to the bottom of the hill, almost all the potential energy has switched to kinetic, and now the cart is at its maximum speed 42

Conservation of mechanical energy In reality, other external forces can be applied such as friction and air resistance Reduce the total energy to conserve over time Actually converted into heat and air displacements (sound waves), so law is correct (equation not complete) We can compensate by adding an extra term E O to the equation E K t + t + E P t + t = E K t + E P t + E O if E O > 0, some energy has been lost In game engines E O is usually quite small and depends at least on velocity (to avoid creating energy) 1.16 43

Momentum The linear momentum p is defined as the mass of an object multiplied by its velocity p = m v the heavier the object, the more momentum, i.e. the more difficult it is to stop same trend for higher velocity as velocity changes constantly, we talk about instantaneous momentum or change over a time interval unit is kg m/s (different from a force) vector in the direction of the velocity 44

Impulse From Newton s second law F = m a m v t + t v t F = t m v t + t m v t F = t F = p F t = p t An impulse is the rate of change of the momentum, i.e. the net force applied on the object multiplied by the amount of time of application an impulse is a force delivered in a very small amount of time, considered as an instant unit is also kg m/s (so also different from a force) 1.17 45

Rotational motion

Rotational motion So far our point object moved along a trajectory and forces were applied on that point object But you want to move actual dimensional objects and forces applied on them make them move and rotate 47

Circular motion Imagine the following object where C is the center of rotation, P a point belonging to the object and r the distance between C and P when the object rotates P travels along a circular path after t, P has moved by a distance s C θ r P s P 48

Angular displacement This angle θ represents the rotation of the object θ = s/r where s is the arc length and r the radius unit is radian (rad) note that 1 radian is the angle describing an arc length of 1 at a distance 1 49

Angular velocity The angular velocity is the rate of change of the angular displacement ω = θ t = θ t + t θ(t) t unit is rad/s 50

Angular acceleration As linear acceleration was the rate of change of the linear velocity, the angular acceleration is the rate of change of the angular velocity α = ω t = ω t + t ω(t) t unit is rad/s 2 51

Equations of motion The five equations stand for rotation as well: ω(t + t) = ω(t) + α t ω = ω(t + t) + ω(t) 2 θ = 1 2 ω(t + t) + ω(t) t θ = ω(t) t + 1 2 α t2 ω(t + t) 2 = ω(t) 2 + 2α θ 52

Linear and angular velocities Every point on a rigid body moves with the same angular velocity Different points on a rigid body can have different linear velocities U(t) P(t + t) C P(t) T(t) 53

Tangential velocity As θ = s/r and r does not vary over time, we have θ = s r We also have by definition ω = θ t So ω = 1 r s t But for small t, s can be seen as a line and not anymore as an arc, so we can use the linear velocity at P to estimate s t This velocity is called tangential velocity (because tangent to the circular path) and noted v t Therefore, for small t, we have ω = v t r 54

Tangential acceleration We can of course defined the tangential acceleration the same way 1.18-1.19 a t = α r where α is the angular acceleration Similarly to the velocity equation v t = ω r 55

Centripetal acceleration Besides the tangential acceleration, there is also the centripetal acceleration of a point on the object a n = v t 2 r = rω2 This acceleration is directed towards the axis of rotation opposite to centrifugal acceleration 56

Rotational dynamics So what causes rotational motion? Forces not applied on the center of mass but on any point belonging to the rigid body Produce a rotation about the center of mass (COM) 57

Torque Suppose a tangential force is applied on a point P belonging to an object, then F t = m a t If we multiply by the distance r to COM F t r = m a t r But we know that a t = r α So we have F t r = m r α r = m r 2 α 58

This defines the torque of F t applied to a point at a distance r from the COM τ = m r 2 α where m is the mass, r the distance to COM and α the angular acceleration of the object unit is N m Torque The torque rotates an object about its axis of rotation through the center of mass 1.20 59

Torque But a force is in general not applied in the direction of the tangent The torque τ is then defined as τ = r F where r is the vector from the COM to the point where F is applied is the cross product, so the direction of the torque is perpendicular to both F and r 60

Newton s Second Law The law F = m a has an equivalent with rotation and torque I is called the inertia more on its form later τ = I α Torque causes angular acceleration where force causes linear acceleration 61

Rotational kinetic energy We can also translate the energy formulas to rotational motion We have the rotational kinetic energy defined as E Kr = 1 2 I ω2 where I is the inertia and ω the angular velocity 62

Conservation of mechanical energy The principle of mechanical energy conservation holds, but one more type of energy must be considered 1.21 E Kt t + t + E P t + t + E Kr t + t = E Kt t + E P t + E Kr (t) + E O where E Kt is the translational kinetic energy, E P is the potential energy, E Kr is the rotational kinetic energy and E O the other energies (surface friction, air resistance etc.) 63

Rotational motion also produces angular momentum about the COM L = r p where r is the distance vector and p is the linear momentum unit is N m s Angular momentum 64

Angular momentum For an object with a fixed mass that is rotating about a fixed symmetry axis, the angular momentum is expressed as the product of the moment of inertia of the object and its angular velocity L = I ω Again, the more inertia the object has, the more difficult it is to stop the object to rotate And the more velocity it has, the more difficult it is as well 65

Impulse We can also apply off-center forces for a very short amount of time Such angular impulse results in a change in angular momentum, i.e. in angular velocity τ t = L 66

End of Essential physics for game developer Next Rigid body physics