|
|
A model decl defines an animated model in the game. Static models don't need decls, they can be specified by the actual file name. Anything that animates does need a decl. All a model decl does is tie a mesh to an set of animations. Therefore if a model doesn't have animations, it doesn't need a model decl. The number of commands that can be in a model definition is quite small, here's a full list:
The channel command allows animations to play only on certain joints. For example, you can have a walking animation playing on the legs, a yo-yo animation playing on the torso, and a chewing bubble gum animation playing on the head. Let's take a look at a shortened version of our good friend, the cyberdemon: model monster_boss_cyberdemon { mesh models/md5/monsters/cyberdemon/cyberdemon.md5mesh channel torso ( *Waist ) channel legs ( *Hips Body origin ROT -*Waist) anim af_pose models/md5/monsters/cyberdemon/af_pose.md5anim anim ik_pose models/md5/monsters/cyberdemon/ik_pose.md5anim anim stand models/md5/monsters/cyberdemon/idle.md5anim anim idle models/md5/monsters/cyberdemon/idle.md5anim anim sight1 models/md5/monsters/cyberdemon/sight.md5anim { frame 16.5 sound_voice snd_sight1 } anim walk models/md5/monsters/cyberdemon/walk3.md5anim { frame 17 sound_body snd_footstep frame 17 triggerSmokeParticle cyber_rfoot_dust frame 37 sound_body snd_footstep frame 37 triggerSmokeParticle cyber_lfoot_dust } anim pain models/md5/monsters/cyberdemon/pain_big1.md5anim { frame 1 call overrideLegs frame 1 sound_voice snd_pain frame 16 sound_body snd_footstep frame 49 sound_body snd_footstep } } You'll notice the mesh and the animations are defined in seperate files and glued together with this decl. That means you can use the same animation file with multiple meshes (really handy). You can also reference the same animation file multiple times in the same model (for example, notice the 'idle' animation and the 'stand' animation both use 'cyberdemon/idle.md5anim'). Apart from tying animations to meshes, this decl type allows us to specify events that happen on certain frames. This makes it trivial to sync sounds and special effects to things like footsteps, weapons fire, etc. In this example, the 'snd_sight1' sound is played on the voice channel at frame 16.5 of the 'sight1' animation. snd_footstep is played on the body channel at frames 16 and 49 of the 'pain' animation.
Here's a chart that lists all the available frame commands:
There are some frame commands that are just shortcuts to various built in events:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Copyright © 2004 id software |