animation advice

Moderator
Posts: 373
Joined: 2006.08
Post: #1
My 3D game that I'm working on supports 3D hierarchies, and I need it to support them in animation too. I'm thinking about using key-frame based animation, and I'm basically wondering:
Would it be better to store the rotation/translation of every key-frame in an array, have a set time that each keyframe takes, and then calculate the translation/rotation of the object based on how much time has gone by between each keyframe, or would it be better to have an array of the key-frame values, and then have an array with varying times in it for each keyframe (so if the object was going in a line, it would use less keyframes and have a different time), and then calculate the translation/rotation based on how much time has gone through on the current key-frame?
Sorry if the explanation was hard to follow Annoyed
Thanks in advance Smile
-wyrmmage

Worlds at War (Current Project) - http://www.awkward-games.com/forum/
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #2
Both seem viable. If you're comfortable constraining yourself to a constant keyframe interval, you might get a more uniform-looking animation; on the other hand, if you specify the interval for each keyframe, you might be able to save a significant number of keyframes throughout the animation.

Also, approach B is a superset of approach A, so you don't lose any flexibility if you go that route.

Had to read that several times before I saw any difference between the two. Wacko
Quote this message in a reply
Moderator
Posts: 373
Joined: 2006.08
Post: #3
Ok, Thanks for the advice Smile Something you said made the sparked a realization that made the decision pretty easy. Since my program is pretty much just advancing through the keyframes and not accounting for lost time if the keyframe max time is exceeded, then I would actually be getting rougher animation if I used more keyframes Rasp
Anyway, thanks again Grin
-wyrmmage

Worlds at War (Current Project) - http://www.awkward-games.com/forum/
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #4
wyrmmage Wrote:Since my program is pretty much just advancing through the keyframes and not accounting for lost time if the keyframe max time is exceeded, then I would actually be getting rougher animation if I used more keyframes Rasp
Sounds like something easily fixed...
Code:
while (timestep > keyframes[keyframeIndex].interval) {
  timestep -= keyframes[keyframeIndex].interval;
  keyframeIndex++;
  keyframeIndex %= numberOfKeyframes;
}
Quote this message in a reply
Post Reply