Animating Weapons

From Valve Developer Community
Jump to: navigation, search
Icon-broom.png
This tutorial needs to be cleaned up to conform to a higher standard of quality.
The content of this tutorial should also be checked to ensure it is user-friendly and easy to follow.
For help, see the VDC Editing Help and Wikipedia cleanup process. Also, remember to check for any notes left by the tagger at this article's talk page.
Blank image.pngTodo: Add more content and finish the tutorial. Also, consider changing the name of the tutorial.

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

Third-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.pngNote: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 (verify this). The names of the character reference, animation and weapon reference should all match.