How do they create dynamic parts of a model in games? (Vehicles, Eyes)

Started by
1 comment, last by ajm113 15 years, 9 months ago
I want to know how game companies create something like a vehicle that has dynamic parts like a gun attached to it on the side like Unreal Tournament or say Team Fortress 2 eyes that look at your foes when you get close. Another example is Flight Simulate with rotating gear and propellers that move on a user command. I know they create the hole model first the export the selected model parts like the gun and then make it it's own model file for the vehicle. Then do some coding to it, but thats the part that gets me is how do they "attach" it and make it work on user command.
Check out my open source code projects/libraries! My Homepage You may learn something.
Advertisement
Quote:Original post by ajm113
I want to know how game companies create something like a vehicle that has dynamic parts like a gun attached to it on the side like Unreal Tournament or say Team Fortress 2 eyes that look at your foes when you get close.

I know they create the whole model first the export the selected model parts like the gun and then make it it's own model file for the vehicle. Then do some coding to it, but thats the part that gets me is how do they "attach" it and make it work on user command.
It's a feature of the game engine, so it really depends on the particular engine that you are using... E.g. in the Source engine (TF2) you would use the attachment point system.

Usually models are animated using a hierarchy of nodes/joints (which can act as "attachment points"). Conceptually, to attach one model to another (e.g. a gun to a hand), you just take the root node of the gun and set it's parent node to the attachment point on the character. Now when the character's joint-hierarchy is updated, the gun will also be updated appropriately.

The code can control these nodes programatically (instead of via animation-playback). For example, you could look up the node which a characters eye is attached to (the modeller would give the node a name, such as "eye_left" to facilitate this), and then manually apply a rotation matrix to this node's transform.
Thanks, I understand now, I knew it had too do something with the bones and their names.

I appreciate your useful reply, thanks again!
Check out my open source code projects/libraries! My Homepage You may learn something.

This topic is closed to new replies.

Advertisement