roll and fall playing with the laws of motion games fundamentals © by jarek francik kingston...

Post on 12-Jan-2016

216 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Roll and FallPlaying with the Laws of Motion

Games Fundamentals© by Jarek Francik

Kingston University, London

2007 - 2013

Agenda

• Laws of Motion• Inclined Plane• Friction• Falling and Throwing• Demo

Newton’s Laws of Motion

1. If no external force acts on a particle,or all the forces are balanced, then the particle moves without any change in velocity

if it was in rest if it was in motionit stays at rest it stays in motion

NEWTON’S LAWS OF MOTION

Notice that the behaviour of objects around usis usually affected by air resistance and friction

NEWTON’S LAWS OF MOTION

2. If unbalanced external net force acts upon an object then the object moves with the acceleration directly proportional to the magnitude of this force and in the same directionand inversely proportional to the massof that object

NEWTON’S LAWS OF MOTION

maFmF

a

The phenomenon of falling is ruled by the Newton’s second law.

The force acting is the gravitational force

The acceration is on the surface of Earthalways the same:

g = 9.81 m/s2

Fg = mg

NEWTON’S LAWS OF MOTION

Notice that the behaviour of objects around usis usually affected by air resistance and friction

NEWTON’S LAWS OF MOTION

3. Whenever A exerts a force on B,B simultaneously exerts a force on Awith the same magnitude and opposite direction

NEWTON’S LAWS OF MOTION

Friction Force

INCLINED PLANE

aFg = mg

INCLINED PLANE

aFg = mg

mg sina

mg cosa

INCLINED PLANE

aFg = mg

mg sina

mg cosa

FN = mg cosa

INCLINED PLANE

aFg = mg

F = mg sina

FN = mg cosa

F = Fg + FN

INCLINED PLANE

a

FN = mg cosa

INCLINED PLANE

aFg = mg

F = mg sina

FN = mg cosa

FF = fmg cosa

INCLINED PLANE

a

a

INCLINED PLANE

V

Vh

Vv

a

INCLINED PLANE

Vh = V cosa

Vv = 0

a

INCLINED PLANE

Vh V cosa

Vv = 0

Friction Force

FRICTION FORCE

FF = f1mg

FF

V

FF

FF = f2mg

V

FF = 0

V = 0

Falling & Throwing

FALL & THROWV

mg

V uniform velocity

F = mg gravitational force

2

02

00

0

0

atatdtVdtS

atVV

atVV

gmF

a

tt

PARABOLIC TRAJECTORY

FALL & THROW

V

Vh

VV

Vh = V cosa

VV = V sina + at

FALL & THROW• If there is no initial horizontal componentVh = 0trajectory is linear

• Non-zero horizontal componentVh ≠ 0trajectory is parabolic

• Both horizontal and vertical components are non zeroVh ≠ 0VV ≠ 0 trajectory is also parabolic

• What if VV < 0 yes, trajectory is also parabolic

Demo

Accelerated Motion

double v = m_sprite.GetSpeed(); v += 10; m_sprite.SetSpeed(v); ... // code above – before Update!m_sprite.Update(GetTime());

or:

m_sprite.SetSpeed(m_sprite.GetSpeed() + 10);

DEMO

Free Fall

double vx = m_sprite.GetXVelocity(); double vy = m_sprite.GetYVelocity(); vy -= 10; m_sprite.SetVelocity(vx, vy);

or:

m_sprite.SetVelocity(m_sprite.GetXVelocity(), m_sprite.GetYVelocity()-10);

DEMO

Bounce

if (m_ball.GetBottom() >= 600 && m_ball.GetYVelocity() < 0)

m_ball.SetVelocity(m_ball.GetXVelocity(), -0.8 * m_ball.GetYVelocity());

DEMO

top related