A question about animation.
I use one for the animation for TransformNode:
const rootNode = new TransformNode('Root Container', scene);
setRootNode(rootNode);
const transformContainer = new TransformNode('Transform Container', scene);
transformContainer.parent = rootNode;
.......
------
movingInSpace: () => {
console.log("movingInSpace started");
_startWalkingAvatar();
/*********animations*************/
var frameRate = 20;
var rotate = new Animation("rotate", "rotation.y", frameRate, Animation.ANIMATIONTYPE_FLOAT, Animation.ANIMATIONLOOPMODE_CONSTANT);
var rotate_keys = [];
rotate_keys.push({
frame: 0,
value: 0
});
rotate_keys.push({
frame: 15 * frameRate,
value: - 2 * Math. PI
});
rotate.setKeys(rotate_keys);
/*******Run Clips**********/
var nextAnimation = function() {
// _stopWalkingAvatar
const walkAnim = scene.getAnimationGroupByName("walk");
if(walkAnim) {
walkAnim.stop();
}
}
scene.beginDirectAnimation(rootNode, [rotate], 0, 25 * frameRate, false, 1, nextAnimation);
console.log("movingInSpace finished");
},
It works well the first time.
But when I rotate the scene with the mouse, animation doesn’t work anymore…