I used attactToBone to bind a box to the dude in the demo. I moved the dude but the box didn’t follow the movement when the bone didn’t have animations.
BABYLON.SceneLoader.ImportMesh(“him”, “/scenes/Dude/”, “Dude.babylon”, scene, function (newMeshes2, particleSystems2, skeletons2) {
var dude = newMeshes2[0];
var box1 = BABYLON.Mesh.CreateBox("Box1", 10.0, scene);
var materialBox = new BABYLON.StandardMaterial("texture1", scene);
materialBox.diffuseColor = new BABYLON.Color3(0, 1, 0);//Green
varterialBox2 = new BABYLON.StandardMaterial("texture2", scene);
box1.material = materialBox;
box1.attachToBone(skeletons2[0].bones[1]);
dude.rotation.y = Math.PI;
dude.position = new BABYLON.Vector3(0, 0, -80);
});
I had the same problem some while ago. Here’s the thread:
Here’s the solution were the Pros came up with:
I hope that helps
From my two cents. I think in your code the box1.attachToBone is missing the second parameter. A reference to a mesh. Here’s a link to the documentation
Thank you very much for your reply. I made the following changes in your example like this, the animation stopped and the sphere did not follow the human movement. The person removed the sphere in place, but the position of changing the sphere will follow the person.