How to accelerate a object?

Started by
1 comment, last by EagleWarrior 22 years, 1 month ago
I need to make my Fighter accelerate it only moves on a constant speed i know the math but i have no idea how to implement it in the code. If u have any ideas or online tutorials that can help me i would be thankful.
Advertisement
There's a couple ways.

You could have offset values that you add to the jet's position every tick. The modification of those values gradually tick after tick constitutes acceleration and deceleration.

OR... you could use the equation d = vel * time + 1/2 * accel * time^2 with vel = vel + accel * time (do both)
vel = current velocity
accel is expressed in distance/time^2 units
d is the jet's position after the time elapsed
(what I mean is, if time is in ms, accel should be in ms^2
otherwise your jet's gonna shoot off the screen before you
get a chance to see it move!)

There are other formulas for handling accurate banking and turning, etc. based on time, but that's too advanced to post here ( actually I have no idea what the formulas are and I certainly couldn't determine them myself without looking it up somewhere! )


Edited by - Waverider on March 5, 2002 3:39:59 PM
It's not what you're taught, it's what you learn.
LoL cool thxs

This topic is closed to new replies.

Advertisement