If we refer to physics 101 (Motion in a Straight Line: Crash Course Physics #1), we will find that linear motion works as follows:
position = initial_position + speed * elapsed_time
Yes, I am assuming no acceleration.
If we work with delta time from the last frame, then initial_position
is just the previous position, so we have:
position = position + speed * delta
speed
must be in units of distance over time, of course. And delta
must be in units of time. When you multiply distance/time
by time
, you get the distance
that the object moved.
moved_distance = speed * delta
position = position + moved_distance
You may need to do a time unit conversion depending of what units you used for speed
and delta
. For example, if your speed
is in seconds, and your delta
is in milliseconds, you would do this:
delta_in_seconds = delta_in_milliseconds / 1000.0
moved_distance = speed * delta_in_seconds
position = position + moved_distance
Note: If you define speed
and position
as a vectors, this continues to work. Which remind me, you should call your "speed vector" velocity
, and your "moved distance vector" displacement
.
So, if you have defined the speed at which an object should move, you can use this approach to figure out how much it moves each frame.
As per getting a delta, you did not specify what language or platform you are using. If you are not using an engine that gives you a delta, refer to How to measure time interval (different languages).