Custom IK¶
Characters in Game Creator have a layered Inverse Kinematic system that can be stack one after another in order to modify the animation of a character. The most common form of inverse kinematics is the Feet IK, which makes sure a character's feet are correctly placed and aligned with the floor below it.
Accessing a Rig¶
Accessing a rig is done using the IK property of the Character's component. To deactivate the rig that aligns the feet on the ground, for example, can be done using:
character.IK.GetRig<RigFeetPlant>().IsActive = false;
Note that character.IK.GetRig<RigFeetPlant>()
returns an instance of that particular rig (null if it can't be found).
Creating a custom Rig¶
Game Creator offsers two types of IK system wrappers:
- Riggings powered by DOTS
- Riggings powered by the
AnimatorIK
method
To create a new IK system you must crete a class that inherits from either TRigAnimationRigging
(for DOTS) or TRigAnimatorIK
(for AnimatorIK). We recommend using the new DOTS-based approach when possible, as it's more performant.
In either case, you should override the DoStartup(...)
and DoUpdate(...)
methods, which are called once at the beginning and every frame respectively.
public class MyCustomRig : TRigAnimationRigging
{
protected override bool DoStartup(Character character)
{ }
protected override bool DoEnable(Character character)
{ }
protected override bool DoDisable(Character character)
{ }
protected override bool DoUpdate(Character character)
{ }
}