Keep track of model movement

Started by
0 comments, last by jpetrie 16 years, 9 months ago
So I have my fully functional bones-system running and now I want to move a character around on my flat mesh. I choose a starting position and translate to it. I render the model. Now its pretty easy to keep track of rotation, since its just one float that changes over time. But it different with the translation-part of it. Lets say I want to move from a position to another. And I want to interpolate between the two to make it look as smooth as posible. Can someone show me the math in it, or maybe direct me to an article explaining it? I know this must be an easy task, but I cant seem to figure it out. Also, would it be better to store a matrix, for each model, as a 16 float array with the translation/rotation info. And then load a matrix from it every frame. Sound posible but maybe a little heavy. If its an idea hwo do I do it? Please enlighten me! =)
Advertisement
Quote:
Now its pretty easy to keep track of rotation, since its just one float that changes over time.

Only if you rotate around a single fixed axis.

Quote:
And I want to interpolate between the two to make it look as smooth as posible. Can someone show me the math in it, or maybe direct me to an article explaining it?

Linear interpolation for translational components, Slerp for rotational components (assuming quaternions, which interpolate better than other forms of rotation).

Quote:
Also, would it be better to store a matrix, for each model, as a 16 float array with the translation/rotation info. And then load a matrix from it every frame. Sound posible but maybe a little heavy. If its an idea hwo do I do it?

It's better to store translation (as a vector), rotation (as a quaternion) and maybe scale (as a vector) separately and compose a matrix only when you need it. Matrices do not interpolate well and extracting the components (rotation, scale, translation) if you need them becomes more difficult.

This topic is closed to new replies.

Advertisement