Tuesday, November 5, 2024
spot_img

Backbone animations don’t run when making a skeleton at runtime – Cocos Creator


Hello everybody,

I’m going through a difficulty with Backbone in CC 3.8.0. I attempted to create a skeleton node at runtime and cargo SkeletonData from a useful resource. The node and sp.Skeleton part had been efficiently created, nevertheless it solely reveals a static picture; the animation just isn’t operating.

Right here is the code:

assets.load('animations/rambu', sp.SkeletonData, (err, skeletonData) => {
    if (err) {
        error(err);
        return;
    }

    const anims = Object.keys(skeletonData.getAnimsEnum()).filter(key => key !== '');

    const skeletonNode = new Node();
    skeletonNode.dad or mum = this.node;

    const skeleton = skeletonNode.addComponent(sp.Skeleton);
    skeleton.skeletonData = skeletonData;
    skeleton.animation = anims[0];
    skeleton.premultipliedAlpha = false;
    skeleton.loop = true;
});

and right here is the outcome:


Creator Model Backbone Help Model
v2.0.7 and beneath v2.5
v2.0.8~v2.1 v3.6
v2.2 v3.7
v2.3 and above v3.8

please be certain the backbone model is compliance with the cocos Model.

You’ll be able to strive with change : transfer assertion get anims to after granting dad or mum for skeleton node.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement -spot_img

Latest Articles