Skeleton Animation Manual

Hello World

In this tutorial, we'll cover the features and usage of the bone editor of Skele.

With Skele's bone editor, developers could pose models and make animation clips inside Unity.

 

Here is a video showing the most basic operations of Bone-editor:

 

Okay, now let's get started! ლ(╹◡╹ლ)

 


Open & Close Bone-editor

The Skele Bone-editor is linked to the standard Unity Skinned-Mesh-Renderer(SMR) component. 

1. Start Editing

 startEdit

If the Skele package is installed correctly into the project, when developer navigates to a GameObject with SkinnedMeshRenderer(SMR) component, he would see the "StartEdit" button like the pic above. Clicking this button will start the bone-editor immediately;

Be noted that, the selection is locked on the current GameObject when the editor is activated.

2. End Editing 

 endEdit

To deactivate the bone-editor, just click the "EndEdit" button.

 

====================================================================

* What's the difference of skinned-mesh and non-skinned mesh?

A skinned-mesh, when imported, Unity will automatically add to it the SMR component, which contains the bones & weight info. Developers should not add SMR by themselves, or they will have to fill a lot of info in the SMR component by themselves too.

A non-skinned-mesh, will be added a MeshFilter(MF) component, which has no bone info.

* How to navigate to the GameObject with SMR?

Before Unity5.2, you could click a skinned mesh twice to navigate to the SMR-equipped GameObject;

Since 5.2, Unity added a feature to cycle the selection under the cursor if developer keeps clicking.

* How to work with the Humanoid-rig models?

Please check these two FAQ posts on Humanoid-rig models:

  1. My model gets into curling pose when I try to make keyframes on it!
  2. How to edit the Humanoid clips?

 


Basic Ops: Move / Rotate / Scale

The most basic operations on joint, like in Unity editor, are “Move” / “Rotate" / "Scale".

(In the skinned model's hierarchy, each transform corresponds to a joint in the model.)

The control method & hotkeys are the same as them in the standard operations in Unity; (i.e.: hotkeys are "W", "E", "R" correspondingly )

===============================

basicOps1

* How to select a joint?

Just click the joint, you don't need to click accurately at the origin, just somewhere near it will do.

a) The purple lines are links between joints, in another word, the bones;

b) The yellow discs are markers for joints, the disc's normal points towards the Z axis of the joint;

c) The selected joint will become blue tinted;

* How to multi-select joints?

You could select multiple joints, then manipulate them together. This is helpful when work with fingers.

a) Shift+LMB to add/remove one joint to current selection set;

b) Ctrl+LMB to add/remove the joint and all its descendants to the selection set;

* How to use the handle? 

Just like how we do on normal GameObjects;

The data fields on top-left (in the pic above), is the pos/rot/scale data for current selected joint, and can be manipulated there;

* How to deselect a joint?

Clicking another joint will change the selection;

If you would like to select none, click "ESC" on keyboard;


GUI-Main

Current GUI scheme is kinda old, and some users have been suggesting we should make a re-design on the GUI layout.

I've been considering to redesign the GUI layout to make it more intuitive and aesthestically pleasing.

But before I get it done, you still need to work with the current one :D

======= Current Main GUI Layout =======

GUI Main1

=======================================

This GUI will be shown when you start the bone-editor; Now let's examine each of them.

"C": Camera reset. This one will set the editor focus on currently selected joint, so you could use orbit and zoom-in/out around that point.

There're four main camera control modes in Unity: FPS, Pan, Orbit, Zoom

FPS is the most familiar mode to most Unity users; under this mode, you hold "RMB" + "WSADQE" to navigate your camera around the scene;

Pan is used by hold "MMB" and move around, it's kinda like FPS mode with only without forward/backward movement;

Orbit is a very useful function when working with models, you could use "Alt + LMB" to orbit around current focus position, the camera will look at the focus point and maintain the distance;

Zoom is...well zoom, scroll the "MMB" or use "Alt+RMB" to zoom in/out on the current focus position;


"R": Reset pose. This function is very useful, it reset the current skinned-mesh to the default pose on the prefab (usually the T-pose / natural-pose, depending on how the modeller does the work)


"G": Pose Manager. It manages the static poses, you could save/load/apply pose to help making animations. This feature needs detailed explanation, we will do it in an individual page;


"I": Bindpose fixer. Not useful, scheduled to be removed in the next major update;


"P": Change orientation. Click this button or click hotkey 'P' will trigger the change of handle orientation. It cycles among the three of "Global/Parent/Local". Hotkey 'P' will only cycle between "Global/Local" as these two are the more useful in usual cases.


"B": Display hidden bones. Unity hides those bones that have no vertices bound to by default. You could toggle this option to change that. 

This option is also very useful when you work with multi-mesh models, it could display all the joints together (even some other non-joint object, such handguns/accessory/etc), not only the bones related to current SMR.


"W": Display the wireframe. Unity by default displays the wireframe of model when selected. It's kind of distracting when edit joints, so we turn it off by default.


"V": Display the vertices marker. Turning on this will display all the vertices with color indicating the weight of current bone. 

vertices


"H": Hotkey list. display a list of hotkeys.


"M": Mirror edit. This feature will be revised later. So leave it alone for now.


"IK": Toggle IK mode. You could toggle between FK & IK mode with this button or hotkey "backquote". IK needs an individual page to explain later.

 


IK Control 

In this page, let's talk about usage of IK(Inverse Kinematics), which is usually compared with FK (Forward Kinematics).

With FK, we move the bones by rotating each joints along the hierarchy.

With IK, we move the whole link of joints by specifying the target position we want the end-effector to reach;

So, In general, IK could improve efficiency in animation authoring; Of course FK has its use-case too, when developer needs to do precise setup for some joints, it's often easier to rely on FK.

Let's get started.


When start bone-editor, we by default use FK mode; To switch to the IK mode, click the "IK" button (mentioned in GUI-Main page) or click hotkey "backquote".

IK 1

As in the above image, when in IK mode, only the IK-link is drawn, and a move-handle is placed at the end-effector.

* How to use the IK?

Drag the handle around, you will see the arm bend/stretch to try to reach the new target position;

* How to select another joint as end-effector?

Press 'ESC' (or click the button 'Reselect End Joint'), will deselect current end-effector, then you could select another joint as end-effector;

* How to return to FK mode?

Press 'ESC' when no end-effector is selected ( or click the 'FK' button in above image );

* How to make the Link-Length longer / shorter?

You could use hotkey 1/2/3 to set the Link-Length, or click the button "+"/"-" on GUI to increase/decrease the length;


There's more about IK than dragging end-effector around.

Rotate around axis

Sometimes you might want to rotate the IK link around the axis from root to end-effector; This will keep the end-effector's position unchanged;

As in the image below, if I want to rotate to make the elbow outward a bit, click the hotkey 'E' under IK mode, this will bring up a slider, slide it to control how much degree we rotate around the axis;

IK rotate

Rotate IK root joint

Click hotkey 'E' again when in 'Rotate around Axis' mode, will get into the 'Rotate IK root joint' mode.

You can directly rotate the root joint of current IK link in a FK fashion.

IK Root 

IK plane

Moving around in 3D-space could be more complex than in 2D-space, 'IK plane' is hereby to help.

IK-plane uses a plane to constrain the end-effector, which means the end-effector will be limited to stay on the plane surface.

The plane is formed by the first 3 joints on the IK link, so try not make them colinear.

The plane could be rotated like described in 'Rotate around axis';

IK plane

IK Pin

IK-Pin is used to pin some joints (usually wrist/ankle) at specified position, and when we drag the root bone (e.g.: hips), the IK will try to make the pinned joint to stay at the specified position.

This feature can help make some motions like crouch.

To use IK-Pin, first place the joints at positions, then click the "IK Pin" button in IK mode, select the joints, click the marker to pin it down, then drag the move handle at hips to get them work; 

NOTE: The function of IK-Pin, is covered by the new constraint system added in v1.9, which we will cover in the constraint system pages. Hence we don't dive into more details of IK-Pin here.

 

The default IK algorithm doesn't utilize constraints, hence it cannot limit the rotation angle at the intermediate joints (like elbow), so it's only recommended to use the default algorithm when making small changes.

Skele is also equipped with CCD IK algorithm which supports constraints setting. We will talk about it in the next page. 


CCD IK + IK-Constraint 

CCD (cyclic coordinate descent) IK is a simple and effective algorithm to solve the IK problem.

CCDIK1

The enable/disable of CCD IK is controlled by the button "New IK Sys Disabled" in above image.

Clicking it will toggle between the "CCD IK" & "default IK". (New IK means the CCD IK)

The control method of CCD-IK is the same as the default IK, what makes the difference is the ability to apply IK-constraints.

IK-Constraints could significantly improve the result quality, e.g.: limit elbow/knee to rotate along a fixed axis.

IK-constraints are in the form of standard MonoBehaviours, so it can be added on the joint like any other behaviours; 

NOTE: Unity's built-in IK solver only apply on limbs of Humanoid models, the IK-solver mentioned here can be applied on any skeleton hierarchy and any length of bone-links.

Angle Constraints

Angle constraint is to limit the joint to only rotate along ONE axis. You could also define the valid range of the rotation angle.

AngleConstraint

(1.1) Setup
Just add the component, if the joints are not colinear, all the things will be setup automatically.

The red axis: the rotation axis, which the joint will rotate around
The green axis: the primary axis, which points the direction of 0 degree.

* What if the red-axis is pointing wrong direction?
The red-axis is supposed to be perpendicular to the two bones linked to this joint. But if the two bones are in the same line, the red axis could get the wrong result.
In such case, just rotate the forearm inward a little and click the "ReInit" button, 

(1.2) Fields intro

  • Enabled: if this toggle is unchecked, IK solver will not try applying this constraint;
  • nextJoint: usually, this is auto-set to the first child of the joint transform, you could change it if necessary.
  • ReInit: clicking this button will trigger calculation of all parameters.
  • Angle Limits: limit the valid range of angles when rotate around the "Rotation Axis", ([-180f, 180f], LHS)
  • Rotation Axis: in 95% cases, you should not change it by hand, just click the ReInit button after rotate the child bone and let the editor to calculate the cross-product for you
  • Primary Axis: in 95% cases, you don't need to change it by hand, this axis by default is in the same direction of the parent bone;
  • Display Settings: some gizmos settings, the changes made here are only valid in one Unity session. You could make permanent changes in the "Edit/Preferences/Skele" settings;

(1.3) Remark

About Angle Limits, it should be <-135, 0> for elbow and knee joints in usual case, 

 

Once the IK-constraints are setup, they will take effect if the owner GameObject lies on the current IK-link.

Be noted that, the IK-constraints only work with the CCD-IK, not the default-IK;

CCD-IK & IK-Constraints can be setup & used in runtime too, we will cover that part in the "Constraint System" document category.


Pose Manager

A pose is defined as the data set of pos/rot/scale info of all or some joints in the skeleton hierarchy.

Pose Manager is used to save/load/apply poses, it can persist the data on the disk;

Toggle Pose Manager

Just click the "G" button on the GUI-Main panel; the new panel shown on the left is the GUI for PoseManager;

PoseManager1

Click the `Load’ button will bring up the "open file dialog", by which you could select an existing pose file to load or switch the current in-use pose file.

Click the `Save’ button will save the current in-use pose file, if there's no underlying pose file yet, this action will prompt to create one;

Poses Management

PoseManager2

The menu displays all the poses in current pose file. 

For each pose, there’re 4 buttons.

The first one is the pose’s name, click the button will Apply the pose to current model.

The second one is delete button, but you need to save to write the change into disk.

The third one is overwrite button, will overwrite the current pose of model into this data.

The fourth one is rename button, will change the pose’s name.

Create Pose

Be noted that, when PoseManager is activated, you cannot modify the joints. It means you need to do the pose first before opening up PoseManager;

When you click a joint, the joint and all of its descendants joints are selected (will be tinted green), you could also add/remove single joint by Shift+LMB.

When you decide which joints are to be saved, click the "New Pose" button, it will prompt a pose name, after confirmation, the data of selected joints will be saved under the given name.

PoseManager3

Quickly add keyframes with Pose

Usually you might want to easily add keyframes with the pose. i.e.: add keyframes for multiple joints with one click.
 
Here're two options:
 
PoseManager4
 
See the image above, be noted that the Animation Helpers UI will appear when Animation Window is open,
 
1. "Snapshot"
 
SnapShot will make keyframes based on the difference between current pose and the T-pose;
 
(1.1) first, pose your model, (e.g:, click the pose in PoseManager)
(1.2) Ensure the AnimationWindow is open, click the "SnapShot" button, it will snap back to T-pose for a second, and add keyframes for the changed joints.
 
SnapShot
 
2. "Set P/R/S Key"
 
"SnapShot" is used to make keyframes as few as possible, but sometimes you might want to have more control on what keyframes to be added. 
 
The "Set P/R/S Key" features enable developers to force adding position/rotation/scale keyframes for current selected joints.
 
For example, if you want to add rotation keyframes for ALL the joints of your model, 
(2.0) first, pose your model, (e.g:, click the pose in PoseManager)
(2.1) use Ctrl+LMB to click the root joint(e.g.: hips), it will select all its descendants;
(2.2) click the "Set R key" to make keyframes;

 

There is also a brief video showing how to use Pose Manager;


 Make Animation

Making animation clips on skinned-mesh with Skele is the same as you make animation on non-skinned meshes;

Enable the bone-editor and Animation view, and manipulate the joints as you like, the modification will be recorded as keyframes in Animation view.

If you're not familiar of how to use Animation View, the official tutorials could be very helpful to get you started with this topics

https://unity3d.com/learn/tutorials/modules/beginner/animation/animation-view?playlist=17099

 


 Hotkeys

Here're the Hotkeys for Bone-editor, using hotkeys will improve efficiency over the GUI buttons;

Common:
  C: Focus on current selected bone's position
  P: toggle LOCAL/GLOBAL PivotRotation mode;
  [ ] \ : switch to Parent / child / sibling bone

FK Mode:
  ESCAPE: to cancel current operation mode;
  W/E/R: switch to MOVE/ROTATE/SCALE mode;
  `(backquote): change to IK mode;

IK Mode:
  ESCAPE: deselect bone / fallback to FK mode;
  1/2/3: change IK LinkLength;
  W: enter IK Move mode;
  E: enter IK Rotate / IK Root Rotate mode;
  X: toggle IK plane lock;
  T: flip the current IK link's middle joint
  `(backquote): change to FK mode directly;