Skip to main content
gamedev.net
🔒 Locked

Time based Deceleration

Started by jClardy Feb 27, 2005 at 1:27 PM 1 replies 1.2k views
Original Post
jClardy
jClardy
Ok, I have been working on a 2d space game. I have 2d acceleration working fine, but now I need to scale a vector down based on time. vx,vy - Velocity accel - Acceleration constant dt - Delta time posx,posy - Object position rotation - Object Rotation vx += accel * dt * cos(rotation); vy += accel * dt * sin(rotation); posx += vx * dt; posy += vy * dt; What I need to do now is slow down the object by a constant factor, but based on time. Is there some kind of formula or equation for this? vx *= deceleration_constant;
jClardy
jClardy
Thanks for the help, your way worked, but I couldn't get the object to stop instead of going backwords. So I did some more googling and found this equation:

vel = vel * constant^time

And it works, scaling velocity down based on time. I found it when I finally realized that this strange force was also called 'friction' [grin]


[google]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.