Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm reading from the FBX format and I'm using Bones to animate an object, and I'm at the point where I have to decide on the code that actually moves the vertexes.

So far I thought on two methods:

Create a bone class that has an array of XYZ and an array of vertexes addresses and the weight. The array of XYZ (and rotations' values) will be filled from their positions/rotations at every frame. My model object will have an array of this bones class, and at each call I'll update the vertexes by multiplying the bones' XYZ for the vertexes, something like:

for(int i = 0; i < object->bonesCount; i++)
    for(int j = 0; j < object->bones[i]->vertexesCount; j++)
        object->bones[i]->vertex[j].xyz *= object->bones[i].xyz; //plus rotation

And the second method is having an array of vertexes * amount of frames, I do something like the above code and I save each vertexes' positions at every frame in the array, so I don't have to call the loop above (I think it might impact performance), but I'd have much more arrays to work with.

So my questions are, (1) which is the best approach for this, and (2) is there another method I didn't think of? Any info related to this is appreciated, as I have nothing done yet and I'm still elaborating on how it should be before I start coding (I try to avoid doing the first thing I come up with so there's less chances of needing to recode it later).


share|improve this question

Usually you don't want to store array of positions of vertexes per frame but rather transformations of joints. This opens room for optimisations like interpolating positions between poses and allows you to blend animations. Such transformation can be stored in efficient so called "SQT" format (Scale, Quaternion of rotation, Translation vector)

struct JointPose
   Quaternion m_rotation;
   Vector3 m_translation;
   float m_scale;

Personally I recommend Game Engine Architecture book by Jason Gregory. Chapter Animations System.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.