Creating Animations

This is a tutorial on how to create animations and import them into the game. This tutorial will assume Maya 2015 for all menus/keybindings/etc.

Skinning a Mesh
The first step to animating a mesh is to give it a skeleton that influences the model. To start creating bones make sure the drop down menu under File is set to Animation, and then go to                    Skeleton > Joint Tool. The defaults of this tool will be just fine to skin a mesh.

Once you have selected this tool, you can click anywhere to create a bone. Clicking again will create another bone and link it to the previous one. Hitting the Enter key will unselect the tool and select all the bones you have created. Clicking twice should look something like this:

If you re-select the tool and click on one of the already created bones, it will select it and allow you to link another bone to the bone you selected. Using this you should be able to create a structure like this:

Selecting a bone will only happen the first time you click with the tool, so to form the above structure you have to select the joint tool, click on the right bone, create a new bone, deselect the tool by pressing Enter, re-select the tool, click on the same bone and finally create the last bone.

Now that we can create bones, you can create a skeleton for your model. Once you have created a skeleton, we can skin it to the mesh.

First, before we skin the mesh we need to zero all of its transform data. To do this select the mesh and go to Modify > Freeze Transformations. Once that is done, we can skin the mesh. Select the root bone of the skeleton (The entire bone structure should look selected) and then shift-select the model so that both the skeleton and the model are selected. Once they are both selected go to Skin > Smooth Bind to skin the model to the bones. Once this is done moving a bone should move parts of the model.

Painting Skin Weights
Now that the model is skinned, we can paint weights on it to make certain vertices only influenced by certain bones. To do this, select the model and go to Skin > Paint Skin Weights Tool. The model should now change to a greyscale color. These colors represent the amount of influence the current bone has on those vertices. To get more detail double click on the icon of a paintbrush and a face on the left-hand side panel. A window like this should pop up:

First off the main panel at the top displays all of the bones skinned to this mesh, as well as their hierarchy. Clicking on any of these entries will select that bone. Once a bone is selected its weights will be displayed on the model. Values closer to white means the bone has more influence, and values closer to black means the bone has less influence on that vertex. To change these values you can use the Value slider, and then click on vertices to "paint" that value onto it. You can use the different Profiles as different brushes to paint with, and you can click Flood to fill the entire model with that value. For demonstration I will make the top bone only influence the top box, and the root node influence both.

A note about the hierarchy, since bones are organized in a hierarchy, any movement at the top of the chain will propagate down. This means in my setup that it is impossible to have each bone only influence one box. Since the top bone is connected to the root node, any time the root node moves the top node will also follow. This means that any vertices influenced by the top node will also move.

After painting the weights, my boxes look like this:

Animating the Model
Now that the bone weights have been painted, we can animate the model. Before we start animating, we need to ensure the model is in the bind position. To do this, select the model and go to Skin > Go to Bind Pose. Now the model can be animated.

To create a keyframe, select a bone and press 'S'. A red bar should appear in the time slider. To animate, simply move the bones and key frame the animation.

IMPORTANT NOTE: If the rotations in your animation are not exporting properly, you do not have enough keyframes. Our engine interpolates between rotations using the shortest path, click on one keyframe, then the next one (without going between them) and imagine how you would get from one to the other using the shortest path, that is how the engine will do it. If you do not want this behavior add more keyframes in-between to create multiple short interpolation paths.

Graph Editor
The graph editor is a powerful tool to tweak your animations to make them look better. To open the graph editor go to Window > Animation Editors > Graph Editor. It looks like this: When you click on an object, the key frames will be displayed in the editor. Pressing the 'W' key will change into translation mode, where you can move the points around to change their value and timing. The X axis the the time axis, and the Y axis is the value axis.

Exporting the Animation
Select the model and go to File > Export Selection, the type of the file should be FBX Export. Under Options, go to Bake Animation, check the box and enter the frames of animation.

The name of the animation should be ModelName@AnimationName.fbx for it to work with the game.

General Maya Tips
To display coordinate axis around an object, select the object and go to Display > Transform Display > Local Rotation Axis