Help with animating 3D object

I don’t know if this is a FAQ or not, but I’d PLEASE like some insight as to how I can import a 3d model (which I’ve found code for) into my opengl program and then animate it!

ie. I have a space ship model. I can import it and display it, but how can I do things like turn the gun turrets, etc. Do I make each of these as seperate objects and then render them all together as a “ship” object? Or is there a simpler/faster way??? (there must be)…

Animating parts of an imported model is always a complicated subjec. Basically you must be able to import your model in pieces, or at least identify the parts. If you can render them separately you can animate them, otherwise…


So you mean that in games like Quake2 or whatever, they model and import EACH body part?? ie. 2x monster arms, legs and then a chest, head and waist???

Or for a spaceship a model for EACH of the sections that move?? (ie. like a space-station having some interstellar sonar dishes, etc)…

NOT flaming you btw., I’m just amazed that there’s not really an easier/cleaner way…


When it comes to mechanical objects, that’s really the easiest way (several smaller objects joined together to form a larger object), but in your example of Quake2, I think they might be morphing between serveral character objects (not sure though, and it’s not in any way easier than using several small objects), which means that they load perhaps 20-30 different versions of the character walking, fireing it’s gun, etc, then morph between these different stances to create a fluid motion.

It is definately a good idea to use separate models for such things like turrets, and comm dishes. Why? Reusability. You can load just one turret model into memory and then draw it where ever there is a turret of that type. The tricky part, and it isn’t all that difficult, is mating two models with a potential arbitrary alignment, e.g. drawing turret on top of ship and drawing same model underneath, or on a side of the ship. Or you could put that burden on the artists and have them make turret models for each of the given orientations. That requires more memory though.

If you don’t want to import color or texture information, there would be the possibility to give each separately animated part of the model its own color, then read the color information from the 3d file and use all polygons/vertices of the same color to determine animated object parts.

It pretty much depends on what type of file you’re importing though, many 3d object files are structured for having ‘sub-objects’.

Another possibility might be, to build your objects as a scene file (each separate animated part being one object in the modeler) and importing the scene file.

Quake 1 and 2 use simply a series of animation phases… first comes a cloud of 3d points, then the definition which vertices span which triangle and then texture coordinates. This is repeated for the number of animation phases in the model. IMHO not in Quake 1 and 2, but 3, they interpolate between the animation phases to make the animation look smoother (keyframe interpolation).