I am trying to make it so that when something happens (like a user presses a key) a certain part of the animation will start. But when I load the model and try to do that it does not work; the model animates in a loop. How can I stop the loop and play a certain part of the animation when the user does something. So far the code I have is:
BABYLON.SceneLoader.ImportMesh("", "https://raw.githubusercontent.com/lando19/test-
assets/main/src/", "scene.gltf", scene, function(newMeshes, skeletons){
var g = newMeshes[0];
g.renderingGroupId = 1;
g.parent = camera;
g.position = new BABYLON.Vector3(1, -2, 5);
g.scaling.scaleInPlace(0.05);
document.body.onclick = function(){
//the code above does not work :(
scene.beginAnimation(skeletons[0], 0.297, 1.443, false, 0.8);
}
});
Here is a repro:
UPDATE: here is the correct repro: https://playground.babylonjs.com/#MRH1GU#26