• 14
• 15
• 10
• 10
• 9

# Simple Question: Smooth Movement

This topic is 3939 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

When I have to move something from point A to B in the simplest possible fashion, I will check to see what the current location is compared to point B and move the current position by a constant amount. This leads to very jerky movements that start and stop immediately with no acceleration/deceleration. When I need smoother movements, the only thing I really know how to do right now is have a velocity variable that increases every frame while speeding up, then decreases while slowing down, but if you need something to land on a specific point this technique is quite difficult. I don't know exactly what I'm looking for is called, so I'm having difficulty just doing a Google search. But if anyone can point me in the right direction for how to make that kind of smooth movement, that would be great.

##### Share on other sites
First, decide the amount of time, T, you want it to take for the something to get from point A to point B. Then you can compute its current location like this: If the current time is t, compute an interpolation factor, s, like this:
    s = 3(t/T)2 - 2(t/T)3
... and compute the current location, P, like this:
    P = (1-s)A + sB

This is a simplified case of a cubic Hermite spline, where the start point is 0, the endpoint is 1 and the two tangents are 0.