[SOLVED] How can I use AnimLayermask after changing bone name

Hello forum!

First, thanks to playcanvas! I got many fun when using this engine.
Here is my problem.
I’m using downloaded human animations for my character. So I have to change my bone name using scripts below. It works fine.

for (var ele of boneNamesList) {
        var bone = this.entity.findByName(ele[0]);
        if (bone != null) {
            bone.name = ele[1];
        }
    }

But when I want to use AnimLayermask to blend gun shooting animation to upper body. It went crazy. I cant just EDIT MASK of the layer for the bone name will change runtime. So I try to set this.entity.anim.layers[1].mask runtime. But it won’t work both when I change the path name to the new bone name or I change the path name to the original bone name. Any ideas?

Any help or advice would be appreciated :slight_smile:

I figure it out myself after hours. But the EDIT MASK function on anincomponent seems buggy. If you edit it ever once your model will go into T-Pose if you dont assign correct mask. I don’t know if it’s same for others or just for me.
My problem is i set the mask bone path with the reference of the path in EDIT MASK menu. IT’S WRONG!
image

//Wrong mask set
this.entity.anim.layers[1].mask =
    {
        'SceneRoot/Avatar_Reference/Armature_0': {
            children: true
        }
    };

You should set the path in reference of Animation asset VIEWER.



So, script below works fine

//Correct mask set
this.entity.anim.layers[1].mask =
    {
       'RootNode/hips/spine/chest': {
            children: true
        }
    };
1 Like

By the way, thanks for the editing!
@ albertos

1 Like