Why I can not move the skeleton

I am new to babylonjs or web3D.
I am try on https://playground.babylonjs.com/#TNT7WW#2
to control the xbot by skeleton with code like this :

var createScene = function () {
var scene = new BABYLON.Scene(engine);
var camera = new BABYLON.ArcRotateCamera("camera", -4.70, 0.9, 4, 
    BABYLON.Vector3.Zero(), scene);
camera.setTarget(new BABYLON.Vector3(-0.06, 0.95, -0.1));
camera.attachControl();

// This creates a light, aiming 0,1,0 - to the sky (non-mesh)
var light = new BABYLON.HemisphericLight("light", new BABYLON.Vector3(0, 1, 0), scene);
light.intensity = 0.7;


BABYLON.SceneLoader.ImportMesh("", Assets.meshes.Xbot.rootUrl, Assets.meshes.Xbot.filename, scene, 
    function(newMeshes, particleSystems, skeletons){

    scene.animationGroups.forEach(function(animationGroup) {
        animationGroup.stop();
    });
    // const xbot = newMeshes[0];
    const skeleton = skeletons[0];
    var spine = skeleton.bones.find(bone => bone.name === "mixamorig:Spine");

    console.log('spine',spine);

    scene.onBeforeRenderObservable.add(() => {
        spine.rotate(BABYLON.Axis.Y, BABYLON.Tools.ToRadians(1), BABYLON.Space.LOCAL);
        // xbot.rotate(BABYLON.Axis.Y, BABYLON.Tools.ToRadians(1), BABYLON.Space.LOCAL);
    });
});

return scene; }

If I try to rotate by xbot mesh, it works. but if I try to rotate by bone of skeleton, failed.
as above code , nothing happens for spine.rotate, works ok for xbot.rotate
can anyone help to tell me why, thanks.

Please go to https://playground.babylonjs.com/ write your repro, save it and post here the link.

thanks for your reminder, I update the question now with playground link.

1 Like

I can rotate with dummy3.babylon but not the .babylon provided in the 1st PG

what am I missing here?

The first one is a glb not a babylon.

2 Likes

do you mean: we can rotate the .babylon file, but can’t do that on glb file?
I also try “BABYLON.SceneLoader.ImportMesh(”“, “Scenes/Dude/”, “Dude.babylon”,”
it dose works bone.rotate on Dude.babylon. I don’t know why not glb.

Please have a look at the playground I posted. You should see the bot rotating.

The glb file format requires you to operate on the linked TransformNode. See the large green arrow as a code comment.

1 Like

Ok, I see, thanks.

1 Like