Skip to content

Custom IK

Characters in Game Creator have a layered Inverse Kinematics system that can be stacked one on top of 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. For example, to deactivate the rig that aligns the feet on the ground:

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

To create a new IK system you must create a class that inherits from TRigAnimatorIK, which is powered by Unity's AnimatorIK method. Rigs are polymorphic items, which means that no registration is required: once the class is created, it will appear in the list of rigs the next time you click on the Add IK Rig Layer button of the Character component.

Every rig must implement the following properties:

  • Title: The name displayed in the Inspector.
  • Name: A unique identifier for this rig.
  • RequiresHuman: Whether the rig requires the character model to be a Humanoid.
  • DisableOnBusy: Whether the rig is deactivated while the character is busy.

Additionally, you can override the DoStartup(...), DoEnable(...), DoDisable(...) and DoUpdate(...) methods. The first one is called once at the beginning, the second and third ones when the rig is enabled and disabled respectively, and the last one is called every frame.

[Serializable]
public class MyCustomRig : TRigAnimatorIK
{
    public override string Title => "My Custom Rig";
    public override string Name => "MyCustomRig";

    public override bool RequiresHuman => false;
    public override bool DisableOnBusy => false;

    protected override void DoStartup(Character character)
    { }

    protected override void DoEnable(Character character)
    { }

    protected override void DoDisable(Character character)
    { }

    protected override void DoUpdate(Character character)
    { }
}

Just like Instructions and other visual scripting nodes, a rig can be decorated using attributes such as Title, Category, Description or Image.

Accessing your Rig

The Name of a rig is a good place to store a constant, so you can reference it from other scripts. Once your rig has been added to a character, you can get it using character.IK.GetRig<MyCustomRig>().