# Keyframe animation?

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

## Recommended Posts

I will be using 3D models loaded in from 3ds max objects that will incorporate keyframe animation. I have an article on how to read in the data from the max file (which is here if anyone is interested), but I'm not sure how the keyframe animation is supposed to work. I've never done anything like this, so can someone recommend a good article/technique? I googled a bit, but came up empty.

##### Share on other sites
basically you take the first frame and the 2nd frame and then, based on the amount of time passed you display the correct frame.
This is normally combined with some interpolation, so if the animation is thusly;
time     frame0         12         24         3

And you goto draw at time point 1, you'd use a point half way between frame 1's point and frame 2's point, if it was at time point 1.5 then you'd be 75% toward frame 2's point and so on.

##### Share on other sites
I think I get it. So let's say that the new point is 3 units away in the x and rotated about the y by 16 degrees. Let's also say that half of the time for animation takes place in a single "tick". Therefore, the vector in question moves 1.5 units in the x and 8 degrees around y. So max has to essentially store some number of copies of the mesh in different positions and I just interpolate between the copies, which are intermediate steps of the animation, the more there are the better the animation will look.

Sound right?

EDIT: Wait, if that's right, then what's the difference between a translation and a rotation? For vertices to rotate, they'd have to be bound about some other part of the mesh (aka a joint)...

##### Share on other sites
I've been thinking a bit more on the matter. Is the fact that I there's no clear way to differentiate between a rotation and a translation in multiple directions indicative of the difference between keyframe animation and skeletal animation? In otherwords, if the vertex was to figure out that it needed to be rotated, it would still need to have a point to rotate about, a joint, and thus could not be done with keyframe animation anyway. So if I want something to appear that it is rotating, I need to set multiple keyframes at moments about that rotation, the more keyframes the smoother the "rotation" appears.

Have I got this down?

##### Share on other sites
pretty much, yes.

You dont have to worry about things like rotation etc at the animation stage as that will take care of its self as you interpolate between the two positions (as an example, take your hand, place it flat in front of you, this is frame 0. Then turn it 90degs, this is frame 1. Now, back to frame 0 and then turn it about 45deg, this is a virtual frame 0.5, which is half way between the two points 0 and 1 and the rotation is accuring).

As you say, the more key frames the smoother things will be (but the bigger the animation in memory), you can also use different interpolation methods, as currently i'm talking about linear interpolation, but there are a few which could help make things look nice.

##### Share on other sites
But I won't know that the object is being rotated, right? It's more like each vertex of the object is being translated to a certain spot, which will simulate the rotation. So let's use the hand example. There's a vertex at the tip of each finger, so when the rotation takes place, the vertex at the tip of the thumb will jump to its next place (based on the length of the tick relative to the total motion), the vertex at the tip of the index finger its next place, and so on. It will look like the hand is rotating (which of course it will be), but actually the position vertices will just be re-aligning themselves to their new spots through a series of translations.

Does that make sense? And if so, is it the right idea?

##### Share on other sites
yes, and yes, thats the basic idea behind it.

##### Share on other sites
Awsome. Thanks, man.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 17
• 14
• 10
• 9
• 11
• ### Forum Statistics

• Total Topics
634095
• Total Posts
3015501
×