# How do I programmatically animate a .obj model?

I am developing on Qt, I have tried translate and rotate an .obj model.

I would like to know is there any possibility to do programmatically animate in Qt.

• This is pretty broad, and it's unclear what you've tried already. I edited your question to remove the request for libraries to do this. Requesting libraries is not a question that's on topic here. – MichaelHouse Sep 13 '13 at 18:46

If you want to do animations, .obj is the wrong format for you. But, never-the-less:

You can do that with mesh-keyframing, or Skeletal animation. Skeletal animation is the typical, newer, choice. But mesh-keyframing still has it's place, and is easy to implement.

Mesh-Keyframing: Is when you have a whole bunch of meshes that represent a model doing certain thing's, when strung together. So, doing it with OBJ models, you might have something like:

Person_Standing.obj
Person_Crouching.obj
Person_LayingDown.obj
...


Where each model has all the same data, just different places for the vertices. You then loop through, blending between two model's, and you have a smooth animation! Though, typically, people use .md2 files for that. There is plenty of documentation on it.

Skeletal Animation: Is when you have a hierarchy much like a skeleton in the human world, your hand's connected to your arm, which is connected to your torso, which is also connected to by your head, other arm, and leg's. You then "bind" the vertices of the mesh to their respective bone, and work out a system in which moving the bone moves the vertices bound to it. Collada files are typically used for this (.dae I believe.)

Here's a couple use-full references for you:

Edit: Some source code for you to reference.

• thanks for your reply there are a lot of useful stuff i ignored , my task is very simple but i dont know how , i want to combine a coaxial rotation along with a translational movement of an .obj aircraft to make a simple simulation of an approach. will it be possible on skeletal animation ? – badrqaba Sep 14 '13 at 15:25
• Oh, that's multiplying multiple matrices, if I understand you correctly. Skeletal animation wouldn't help with that, no. Skeletal animation is for deforming the mesh, not transforming the model. Tutorial 11 of the second link, "Concatenating transformations", should be what your looking for. – Wolfgang Skyler Sep 14 '13 at 17:03
• thats right , in the tutorial its simple cause they are using a simple object , what am looking for is how am gonna do whats inside the tutorial with an .obj model. thanks – badrqaba Sep 14 '13 at 20:49
• You have already loaded the .obj file, right? – Wolfgang Skyler Sep 14 '13 at 22:34
• yes i did so whats next ? – badrqaba Sep 14 '13 at 23:03