• Create Account

# reaperrar

Member Since 12 Mar 2011
Offline Last Active Feb 08 2015 11:48 PM

### #4822686Basic time scaled movement

Posted by on 13 June 2011 - 04:11 AM

### #4821536Basic time scaled movement

Posted by on 09 June 2011 - 06:20 PM

So lately for time scaled movement I've just been using this:
Position += Velocity * DeltaTime;

Which worked fine until I added acceleration...

Acceleration = (force * frictionforce) / mass
_____________________________________
Velocity += acceleration * DeltaTime;

Position += Velocity.

Problem is (if you haven't already spotted which you guys probably have) the velocity is no longer scaled.
Faster machines = faster objects ><

Here's an example of the math I did, comparing a machine that runs at one frame per second and a machine that runs at 5 frames per second.
Acc = 50 / second
Initial velocity = 0 / second

Machine 1
Time: - - - - 1.0
velocity: 0 0 0 0 50
Position: 0 0 0 0 50

machine 2
Time: 0.2 0.2 0.2 0.2 0.2
velocity: 10 20 30 40 50
Position: 10 30 60 100 150

So machine 2 (in this case) moves three times further than machine 1 in the same time span.

How can I fix this?

PARTNERS