Calculations in Physics and Game Engines Games Fundamentals © by Jarek Francik Kingston University, London 2007 - 2013.

Slides:



Advertisements
Similar presentations
Motion & Forces.
Advertisements

Free fall with air resistance Forces which resist motion play an important part in everyday life: –Brakes in cars; friction in many forms, damped vibrations.
Universal Gravitation & Universal Circular Motion Review Questions Divided by Category.
Fall Final Review WKS: WORD PROBLEMS. Average Speed 1. A rock is dropped from the top of a tall cliff 9 meters above the ground. The ball falls freely.
Causes of Circular Motion Chapter 7 Section 3. Force That Maintains Circular Motion  When an object is moving in a circular path, it has a centripetal.
Honors Physics Chapter 2 Kinematics in One Dimension
Chapter 2 Motion in One Dimension (Kinematics). 2.1 Displacement and Velocity Distance is a measure of the total motion of an object (how far it has traveled)
Hunter, Kevin Yu, Marcus. These Next Few Steps Using the Newton Law of motion and some outside research, we will derive the basic equation that describe.
Newton’s Laws of Motion three laws of motion: fundamental laws of mechanics describe the motion of all macroscopic objects (i.e., everyday size objects)
With the rockets we described last time, we are no longer earthbound!
Gravitational Potential energy Mr. Burns
Chapter 8.  Imagine a cannon, perched high atop a mountain, firing a cannon ball with a given horizontal speed. The cannon ball is a projectile, so it’s.
TOPIC 6: Fields and Forces. What is gravity? Is there gravity in space? Why do astronauts float? What keeps the moon from flying off in space?
Honors Physics Semester 1 Review PowerPoint. Distance vs Displacement Distance = magnitude only = 8m Displacement = magnitude and.
Newton’s Third Law of Motion
Motion occurs when an object changes position.
What are Forces? A force is a push or a pull on an object.
: Force and Motion Test Review: Jeopardy Game. $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300.
Motion I Kinematics and Newton’s Laws Basic Quantities to Describe Motion Space (where are you) Space (where are you)
PHYSICS MR BALDWIN Speed & Velocity 9/15/2014
Unit 2 Pages , , and Gravity Sir Isaac Newton Why do objects fall? A force pulls objects downward, towards the center of the Earth.
Gravity, Air Resistance, Terminal Velocity, and Projectile Motion
Problems Ch(1-3).
AGENDA 31-OCT Binder check today! Binder check today! Notes - Projectile Motion Notes - Projectile Motion CW - Plotting Projectile Motion Activity &
Newton’s Law of Gravitation. Newton concluded that gravity was a force that acts through even great distances Newton did calculations on the a r of the.
TOPIC 6.1: Gravitational Fields and Forces These notes were typed in association with Physics for use with the IB Diploma Programme by Michael Dickinson.
Newton’s Law of Gravitation. Newton concluded that gravity was a force that acts through even great distances Newton did calculations on the a r of the.
Gravity ISCI More Free Fall Free Fall Vertical and Horizontal Components of Free Fall.
Universal Law of Gravity. Newton’s Universal Law of Gravitation Between every two objects there is an attractive force, the magnitude of which is directly.
Kinematics Where? When How fast? Free fall Projectile Motion.
Roll and Fall Playing with the Laws of Motion Games Fundamentals © by Jarek Francik Kingston University, London
Ticker Tape and Definitions Station ……..……
Fast Moving Projectiles: Satellites The Earth satellite is simply a projectile that falls around the Earth rather than into it.
Kinematics What rules govern an objects motion?. Answer Me!!! List three things that come to mind when you hear the term motion? After creating your list,
Chapter 7 Models for Wave and Oscillations Variable Gravitational acceleration –Lunar Lander –Escape velocity Wave motion and interaction –Pendulum without.
One of the most significant intellectual achievements in the history of thought.
Uniform Circular Motion (UCM) The object travels in a circular path with a constant speed. Its velocity is tangent to the circle and is changing due to.
Universal Gravitation Gravity is the way in which masses communicate with each other.
PHYS 1441 – Section 002 Lecture #8 Monday, Feb. 11, 2013 Dr. Jaehoon Yu Maximum Range and Height What is the Force? Newton’s Second Law Free Body Diagram.
Universal Gravitation - Isaac Newton Combine Kepler’s Laws with Newton’s three laws of motion to get: “Between any two objects there exist an attractive.
Rocket Propulsion Physics Montwood High School R. Casao.
TOPIC I.. I. Branch of Mechanics that deals with motion without regard to forces producing it. Branch of Mechanics that deals with motion without regard.
Physics Test Review Test Tuesday. Newton’s 1 st Law of Motion 1. An object at rest will remain at rest, and an object in motion will remain in motion.
SPH3U – Unit 2 Gravitational Force Near the Earth.
Welcome Scientists! Today: Return and Go Over Formative Quiz Review For Force and Motion Test.
Newton’s Law of Universal Gravitation. What do we know about gravity?
Universal Gravitation Eleanor Roosevelt High School Chin-Sung Lin Lesson 12.
Chapter 2 Motion. 3 Properties of Motion: Speed: Change in distance per unit of time. distance/time or v=d/t. The units can be mi/h, km/h, m/s, etc..
Newton’s Laws A Summary.   English mathematician, physicist, astronomer.  Born the same year Galileo died  Began to prove Galileo’s theories.
Motion I Kinematics and Newton’s Laws Basic Quantities to Describe Motion Motion is about Space (position) and Time (duration) and how we change position.
Uniform circular motion is the motion of an object traveling at a constant speed on a circular path. Uniform Circular Motion.
What is the centripetal force acting on a 2000 kilogram airplane if it turns with a radius of 1000 meters while moving at 300 meters per second? a c =
Law of Gravitation. Law of Gravity  Gravitational Force  All objects have mass and therefore will attract all other objects.  The size of the gravitational.
Newton’s “4 th law”. Law of Universal Gravitation 1.Gravity is universal: ALL objects attract each other. 2.The force of gravity is directly proportional.
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.
PHY 151: Lecture 6A 6.1 Newton’s Law of Universal Gravity 6.2 Gravitational Formula 6.3 Extending Particle in Uniform Circular Motion Model.
A. Motion is when an object changes its position relative to a reference point ( an object or place is used to determine if an object changes position).
Review velocity is (change in position)/time elapsed acceleration is (change in velocity/time elapsed Changes can be in magnitude or in direction or both.
Copyright © by Holt, Rinehart and Winston. All rights reserved. ResourcesChapter menu Circular Motion and Gravitation Chapter 7 Table of Contents Section.
L2 Forces, Mass, Acceleration, Pressure, Review of Exponents.
Kinematics and Newton’s Laws
NEWTON’S 2nd LAW.
The first midterm quiz is Friday, September 29
GRAVITY – ITS NOT JUST A GOOD IDEA …. IT’S THE LAW!!!
Motion and Forces.
Kinematics Formulae & Problems Day #1
A Simple Model of a Rocket
What do the words ‘net force’ mean?
Ticker Tape and Definitions Station
Ticker Tape and Definitions Station
Presentation transcript:

Calculations in Physics and Game Engines Games Fundamentals © by Jarek Francik Kingston University, London

Simple Stuff Uniform Motion (constant speed or average speed) If my average speed is 60mph, how long does it take to Bristol (120 miles)? The answer is: v – velocity or speed x – distance or displacement t – time Bristol 120mi

Simple Stuff Uniform Motion (constant speed or average speed) Rocket is travelling in straight line from the Earth to the Moon (roughly 360,000 km). How long does it take if its average speed is 10 km/s? v – velocity or speed x – distance or displacement t – time The answer is:

Not so trivial, but still simple Accelerated Motion (uniformly increasing speed)  v – increase of velocity a – acceleration v 0 – initial speed Rocket is taking off and gaining the speed with the acceleration of a=10 m/s 2. How long does it take to achieve its maximum speed of 10 km/s?

Not so trivial, but still simple Accelerated Motion (uniformly increasing speed)  v – increase of velocity a – acceleration Rocket is taking off and gaining the speed with the acceleration of a=10 m/s 2. How long does it take to achieve its maximum speed of 10 km/s?

Not so trivial, but still simple Accelerated Motion (uniformly increasing speed)  v – increase of velocity a – acceleration A new model of the rocket accelerates at a=10 m/s 2 to the mid-point between the Earth and Moon (180,000 km away). What is the maximum speed now?

Not so trivial, but still simple Accelerated Motion (uniformly increasing speed)  v – increase of velocity a – acceleration A new model of the rocket accelerates at a=10 m/s 2 to the mid-point between the Earth and Moon (180,000 km away). What is the maximum speed now?

Facts Apollo 11 top speed was km/s (39,897 kmh or 24,791 mph) Average Earth – Moon distance is 384,400 km (238,850 miles) We took 360,000 to simplify the calculations Realistic trajectory of a lunar flight is far from the straight line

Facts Apollo 11 top speed was km/s (39,897 kmh or 24,791 mph) Average Earth – Moon distance is 384,400 km (238,850 miles) We took 360,000 to simplify the calculations Realistic trajectory of a lunar flight is far from the straight line

Game Physics Exercise

"Minecraft" is a trademark of Notch Development AB In a physically realistic mod for a game similar to Minecraft there is a small cart of mass 10 kg, standing still in a distance of 6 meters from a solid, vertical wall. Suddenly, the cart acquires an impulse (a hit) J = 40 Ns perpendicularly towards the wall. It moves forward, bounces from the wall and then moves back. How far from the wall is it when it eventually stops due to friction forces? the friction coefficient f = 0.1 coefficient of restitution e = 0.5 gravitational acceleration in this world is similar to the Earth: g = 10 m/s 2.

Initially, the cart was standing still, so v 0 is velocity just after the hit: solve in regard to t to find the bounce time deceleration due to friction at the bounce time:

Initially, the cart was standing still, so v 0 is velocity just after the hit: deceleration due to friction at the bounce time: after the bounce! time until the stand still: distance travelled: But wait a moment, all that may be done in a much simpler way!

Initially, the cart was standing still, so v 0 is velocity just after the hit: deceleration due to friction at the bounce time: after the bounce! time until the stand still: distance travelled: But wait a moment, all that may be done in a much simpler way! solve in regard to t to find the bounce time

Initially, the cart was standing still, so v 0 is velocity just after the hit: You may be familiar with the following formula: from which you find the velocity immediately: and further as previously...

Initially, the cart was standing still, so v 0 is velocity just after the hit: You may be familiar with the following formula: from which you find the velocity immediately: and further as previously... but this is not yet exactly what I mean...

Initially, the cart was standing still, so v 0 is velocity just after the hit: t [s] v [m/s]

back now to... the rocket flying to the Moon but this time THE HARDCORE WAY

Hardcore Stuff The rocket is now burning its fuel, and the further it’s flying, the lighter it is. Initial mass is m 0 = 20,000 kg and the acceleration a 0 = 5 m/s 2, but the rocket is losing  =1 kg/s during the flight. The jet force is constant. What will be the speed and distance from the Earth after the first hour of the flight? Firstly, the easy thing: the jet force can be found from the initial conditions: Now, the mass of the rocket as the function of time: Next step, the acceleration: The acceleration is changing over the time, and the velocity calculation won’t be easy!

Physics of Motion Average acceleration is change of velocity over time: Exact acceleration – is the derivative of velocity: To calculate velocity (as a function of time), you simply need to integrate velocity in regard to time:

Physics of Motion To calculate velocity (as a function of time), you simply need to integrate velocity in regard to time: – if acceleration is constant: – if acceleration changes over time – integrate!

Physics of Motion Average velocity is displacement in time: Exact velocity – is the derivative of displacement: To calculate displacement, you need to integrate velocity in regard to time:

Physics of Motion To calculate displacement, you need to integrate velocity in regard to time: – for Uniform Motion: – for Accelerated Motion: – for any other type of motion – simply integrate!

Hardcore Stuff After an hour of flight (3600 secs): Knowing acceleration, calculate velocity:

Hardcore Stuff After an hour of flight (3600 secs): Knowing velocity, calculate displacement:

Hardcore Stuff Let’s go to the next level of difficulty – the rocket is affected by the Earth gravity. In outer space, this is non-linear and drops with the square of the distance from the Earth – the rocket is also affected by the Moon gravity. It’s non-linear and rises with the square of the distance to the Moon – the jet force is not constant: it is controlled by the astronaut and may change in any time, irregularly

Numerical Integration Wait a moment, there must be an easier way: – Game Developers are smart, but they may not like integrating that much – Methods of analytical integration are not even covered in this module! – Logarithms are hard to calculate for computers So? Of course there is!

Numerical Integration t [s] v [m/s] approximated value! good if  t is small enough

Numerical Integration t [s] v [m/s]

Numerical Integration t [s] v [m/s] difference equations – equations that determine the difference between the (n) th and the (n+1) th

Numerical Integration t [s] v [m/s]

Numerical Integration t [s] v [m/s]

Numerical Integration double v = rocket.GetSpeed(); double m = rocket.GetMass(); m -= mi; double a = F / m; v += a; rocket.SetSpeed(v); rocket.SetMass(m); rocket.Update(GetTime()); this function updates the sprite’s location  t is often considered to be 1

Numerical Integration Numerical integration is based on repeating simple operation (addition) many times Numerical Integration is approximate, but with small values of  t it is sufficiently good If you have any concerns, play Angry Birds (or any other game with good physics)

Numerical Integration Most people are not very good in integration Mathematicians are good in symbolic integration, but computers find it challenging Computers are very good in numerical integration, but people very ineffective in it!

Numerical Integration Integrator – any component (hardware or software) calculating a single sample in Numerical Integration GFC OnUpdate / Update functions are examples of integrators CSprite::Update function uses the current velocity to update the position of the sprite moving it by  x = v  t, and  t=1/60 sec. Another example of basic integration step is modelling the gravity: sprite.SetVelocity(sprite.GetXVelocity(), sprite.GetYVelocity() - 10);

Numerical Integration Interpolating Functions used in NI: – rectangle rule – trapezoidal rule – Simpson’s rule (parabolic)

Today’s Workshop Task In Your Rocket: – throttle is controlled by the player – the more thrust, the more fuel is burnt – the total rocket mass is the net mass plus the fuel – the rocket operates in the overlapping gravitational fields of the Earth and the Moon – the net force acting on the rocket is a sum of the two gravitational forces and the engine thrust – calculate the acceleration from the 2 nd law of motion

Isaac Newton’s Law of Universal Gravitation Every point mass in the universe attracts every other point mass with a force that is directly proportional to the product of their masses and inversely proportional to the square of the distance between them

Isaac Newton’s Law of Universal Gravitation Every point mass in the universe attracts every other point mass with a force that is directly proportional to the product of their masses and inversely proportional to the square of the distance between them r M m

Values Gravitational constant G is one of the fundamental constants of our Universe G Gravitational Constant6.67∙ Nm 2 kg -2 Mass of the Earth5.97∙10 24 kg Mass of the Moon7.35∙10 22 kg ( Earths) Radius of the Earth6378 km Radius of the Moon1737 km (0.273 Earth) Average Earth-Moon distance384,400 km Average Earth-Sun distance149,597,870 km

Values In a Game Engine rarely there is a need to use real world values GM value for the Earth12000 GM value for the Moon3000 (0.25 Earths) Radius of the Earth225 pixels Radius of the Moon180 pixels X coordinate for the Earth-100 X coordinate for the Moon900 Earth-Moon distance1000 pixels own mass of the rocket120 – plus up to 100 fuel thrust multiplier25 these are simply the values that worked fine for me a very much different set of values may be fine for you