Smooth movement (maybe called tweening?)


How can I make anything move from point A to point B smoothly? At the moment I have just used a loop to increment closer to point B and if the position equals it, then stop the loop.

The motion is very linear but I am looking for it to ease out of position A and then ease in to position B. I hope I am explaining this correctly :(. I am sure I have seen the word Tween used before in other programming languages to perform this task, just cant remember which one.

edit: better way of explaining - like bezier IPO curves in the game engine from point A to point B with python.


Unless you want this to be realtime due to keypressed (in which case just use linv for rigid bodies), you have two options:
1)FCURVE action (easy and self explanatory)
2)Use vector displacement.
E.g, get the vector between point a and point b, then set the object at a position along that vector.
Either use a vector between the object and point b, and times the magnitude by a constant between 0 and 1, but that only smooths toward the later end.
You could use some extra maths to work out which point is closer to the object and use that as a constant or something… i ramble as i am tired !

You may want SLERP as opposed to LERP.

Ok thanks agoose, I think I’ll go down the vector route to give me more control over the interpolation between the limits. Okay, on to more searching :slight_smile:

I think using actions for all the movements and rotations will be a pain to manage in my project. I am lookin for something a bit more generic.

Thanks for help man