Jump to content

  • Log In with Google      Sign In   
  • Create Account


reaperrar

Member Since 12 Mar 2011
Offline Last Active Aug 25 2014 08:45 PM

#4822686 Basic time scaled movement

Posted by reaperrar on 13 June 2011 - 04:11 AM

Tyvm for your help


#4821536 Basic time scaled movement

Posted by reaperrar 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