๐ฆพRig
In this section you will learn about the character skeleton.
Last updated
In this section you will learn about the character skeleton.
Last updated
The Scriptable Animation System introduces a new way of storing the information about the character skeleton hierarchy - Rig Assets.
Rig Asset is a Scriptable Object, which contains:
Character Skeleton hierarchy
Element Chains
Animation Curves
To create a new Rig Asset Right click -> KINEMATION -> Rig:
In order to update the character skeleton hierarchy, it's required to provide a K Rig Component reference. To do this, attach the K Rig Component to the root bone of the skeleton hierarchy:
Rig Component will iterate over all child transforms of the root bone and include them in the hierarchy collection. Then, you you will need to specify the Rig Component reference in your desired Rig Asset and hit the Import Rig button/
The Rig Asset does not store the Transform references, instead, it has a List of KRigElements - a struct which has a name and an index of the element in the hierarchy.
Then, you can retrive the Transform reference based on the KRigElement:
Thanks to this system we can select bones we want to modify in the data assets without holding a reference to the bone!
The Rig Asset has another cool feature - automated bone selection. If you want to select a bone from the pop-up window in your custom script, make sure to implement the IRigUser interface:
The only method this interface provides is GetRigAsset - it will be used by a custom drawer to select a rig element.
Now, simply add a KRigElement to your script:
Now when you get back to the Editor, you will be able to select an element from the hierarchy. This concept is used for Animator Layer Settings and other entities in the framework.
And in the next section we will learn about the new layer system!
This struct represents the element in the hierarchy:
Rig Elements are visually represented as selectable widgets in Rig Asset, Animator Layers and other scripts:
The Rig Element does not represent the Transform itself, so you need to re-trieve the Transform reference via the Rig Component:
When you select an element in the editor, the system caches the index in the hierearchy automatically. However, it is also possible to get a Transform reference by a string name only:
Tip: Transforms re-trieved via the Rig Component are always valid, unless the index is inentionally changed in the constructor. If the Rig Element is empty, the Rig Component will return a reference to the root bone.
KPose is a struct that represents an element pose in the Kinemation Rig. Let's see what fields it has:
The KPose has many applications, like pose caching, blending and a convenient pose offset. For example, it is very convenient for bone modifications: