Animating Weapons

From Valve Developer Community
Revision as of 09:21, 24 May 2006 by BJ (talk | contribs) (general clarification (child vs parent, etc.))
Jump to navigation Jump to search

This page describes how to setup world models (Maya-specific; generally applicable to other modeling applications) so that they can animate. Animating view model weapons is a much simpler case, described elsewhere. By animating your world model weapons, you can create weapons which are dynamic and not just glued to the character's hand.


3rd person weapon animation requirements

When a weapon that is attached as a separate object (by code) needs rotation or translation in the animation.


Weapon

Add the necessary bones to the weapon model for the particular type of animation you require and skin the model. Save this an individual entity and export it as your weapon reference.


Character for animation

Open the character reference and import the weapon you have created which is skinned and positioned. Attach it to the relevant character bone to which it is to be attached by code. This will make the rig ready for animation and you can animate the weapon as a separate model within the scene. As the weapon is skinned then the bone information that is attached will be exported through the animation smd. Save your file as something different from the original character reference.


Note:

Delete the prefix on the imported geometry and bones so they match that of the weapon exported for attachment by code.


Character for Reference

Take the character file just created with the weapon attached. If you exported the character now then the weapons geometry would be exported along with the character. As the weapon model is attached via code, you should delete all the weapon model polygons apart from one, so the mesh is almost completely gone apart from the few faces which carry the skin information. This allows the bones to be exported and, in turn, allows the animation to drive the attached weapon if there is any animation applied.


Basic rules

All bones need skin applied to be read by the exporter (as far as I know). The names of the character reference, animation and weapon reference should all match.