ðŸŦĨAvatar Mask

Setup an Avatar Mask

Create an Avatar mask.

Follow these steps in project view : Right Click> Create > Kinetix > AvatarMask

In the inspector, you can click on each individual node to enable (in green) or disable (in red) the bone. Hovering the node will show the name of the bone.

For the Mask to be applied on a character, you need to call the corrisponding SetMask method.

void SetMaskOnLocalPlayer(
    KinetixMask _Mask
);
KinetixMask GetMaskOnLocalPlayer();

Example:

[SerializeField] public KinetixMask mask;
[SerializeField] public Animator myAnimator;

//This code is from the Quickstart example
private void Awake() 
{
    KinetixCore.OnInitialized += OnInitialize;
    KinetixCore.Initialize(new KinetixCoreConfiguration()
    {
        GameAPIKey = "yourGameAPIKey",
        PlayAutomaticallyAnimationOnAnimators = true,
        EnableAnalytics = true
    });
}
    	
private void OnInitialize()
{
    KinetixCore.OnInitialized -= OnInitialize;
    
    //Register local Player
    KinetixCore.Animation.RegisterLocalPlayerAnimator(myAnimator);
    
    //Set Mask
    KinetixCore.Animation.SetMaskOnLocalPlayer(mask);
}

Runtime Avatar Mask Setup

The KinetixMask can be modified in runtime using the method SetEnabled

Example:

[SerializeField] public KinetixMask mask;

private void Start() 
{
    mask.SetEnabled(HumanBodyBones.Hips, false); //Disable the hips on start
    mask.SetEnabled(HumanBodyBones.LeftHand, false); //Disable the left hand on start
    
    Debug.Log( mask.IsEnabled(HumanBodyBones.LeftHand) ) //Log: False
}

Runtime Create Avatar Mask

private void Start() 
{
    KinetixMask myMask = ScriptableObject.CreateInstance<KinetixMask>();
    //Do stuff with the mask
}

Last updated