Prefix: I am very much new to 3d modeling and programming. I
appreciate that this maybe somewhat off topic.
I was wondering if anyone has recommendations as to an easy method of
moving elements of a 3D model. For example a rudder on a plane. I have
written my own 3ds file format parser and openGL renderer which works
for static models, so i could have a model of a plane, and then
individual models for each of the "moveable" elements.
Using this approach i believe that this would require that the axis of
rotation etc would need to be hardcoded into the source code for each
of the moveable items. Ideally i would like to say "plane.rudder.angle
= 5.0; plane.left_flap.angle = -1.0;" etc etc where "rudder" and
"left_flap" were "moveable" elements in the model. AFAIK, the level of
information to facilitate this is not contained in a 3DS model.
Is there a different file format that can be used in this instance?
Unfortunately i dont
really know what to search for on the net.
Thoughts/Recommendations appreciated.
Jason
Disclaimer: I'm more of a programmer, not an artist. However, to my
knowledge, in most 3D packages, you can set up a hierarchy of parts of
the model. For example, a tank may have a separate part for the
turret, which can rotate. Or, bipedal humans will have two legs, each
of which has a bunch of separate pieces. These are all part of the
model's whole, but due to the hierarchy, they can be manipulated
separately.
This way, the rudder on a plane is just the same as the foot on a
human -- part of the model, but can be moved independently. What you
should do is two pronged: (1) use your modeling software to create a
model with multiple pieces. (There are probably several example files
in its tutorials section.) (2) Make your graphics code able to read
and display such files. Once you can do that, then you can hook up
some sort of abstraction layer, so that your game can say "rotate
rudder 5 degrees left" and that turns into the appropriate matrix
applied to the rudder's piece.
Nathan Mates
--
<*> Nathan Mates - personal webpage http://www.visi.com/~nathan/
# Programmer at Pandemic Studios -- http://www.pandemicstudios.com/
# NOT speaking for Pandemic Studios. "Care not what the neighbors
# think. What are the facts, and to how many decimal places?" -R.A. Heinlein
Maybe I misunderstand what you want, but the 3ds file format certainly
has a hierarchy of parts, with transformation matrices defining the
relationships between them. In fact it seems to have even more
elaborate support for hierarchial modeling than that ... looking at the
definitions in lib3ds/node.h, I see things like quaternions etc ....
-Miles
--
/\ /\
(^.^)
(")")
*This is the cute kitty virus, please copy this into your sig so it can spread.
Many Thanks. I am a newbie at this, and was not aware of the
capabilities of 3ds or that lib3ds was readily available (so i didnt
need to roll my own!)
Jason
Here's the library I was talking about:
http://lib3ds.sourceforge.net/
Even if you want to continue using your own library, lib3ds would
probably be a good source of information.
-Miles
--
Insurrection, n. An unsuccessful revolution.