PDA

View Full Version : animating movement



06-03-2000, 04:39 AM
How does one animate movement between coords.

like this:
(only xy coords for simplicity)
Between 0.0,0.0 and 3.0,5.0 and then from there to 6.0,-2.0

PS. i AM incredibly clueless, so try to keep it simple :-) DS.

ngill
06-04-2000, 10:56 PM
I am not sure of the question, but perhaps a loop?!

06-05-2000, 12:07 AM
I was thinking more in the ways of moving something along a 'path' but i dont know if this is possible.

Bob
06-05-2000, 02:30 AM
If I get you right, you want to specify controlpoints along your path?

Then you can make a structure for each controlpoint, and it can look something like this:




struct controlpoint
{
float point[3]; // controlpoint coordinates
float rotation[3]; // the rotation for each controlpoint
... and so on
}


You also need a timevariable called t for example. To determine between what controlpoints you are, just use a=floor(t), and you know you are between point a and a+1. Then you just interpolate between those two points using t-a as interpolation factor

You can also use some other obscure methods to smoothly interpolate between two points, like Bezier and NURBS, cosine- and cubic interpolation.

If you are using a the above structure with all kind of information you want, you can animate a camera (for example), specifying camerapoint, camera targetpoint, upvector, fov and whatever you like, for each controlpoint. And using a real time variable, the camera will move from on point to another in the same time independant of your framerate.

Here are some places you can look at. http://www.flipcode.com/tpractice/issue03.shtml http://freespace.virgin.net/hugo.elias/models/m_perlin.htm

06-06-2000, 12:49 AM
Bob, you just made my heroes list :-)

Thank you !!!!!