Three.js mixer.time = n 不在第 n 个 blender 帧上播放,mixer.time=n/1000 也不播放
Three.js mixer.time = n doesn't play on the n'th blender frame, nor does mixer.time=n/1000
在blender中,我的动画总长度为250ms。
但是当我将 运行 动画播放到
mixer.time = 100/1000;
只播放了一部分动画
mixer = new THREE.AnimationMixer(cube);
gltf.animations.forEach((clip) => {
mixer.clipAction(clip).play();
});
});
...
function seekAnimationTime(animMixer, timeInSeconds){
animMixer.time=0;
for(var i=0;i<animMixer._actions.length;i++){
animMixer._actions[i].time=0;
}
animMixer.update(timeInSeconds)
}
如何制作动画 运行 某个 "frame" 或 blender 单位的时间?
感谢任何帮助。
使用
var duration = 0;
...
mixer = new THREE.AnimationMixer(cube);
gltf.animations.forEach((clip) => {
duration = clip.duration;
mixer.clipAction(clip).play();
});
...
if(mixer!=null){
var tar = 50; // percentage you want to play to
var mul = duration*(tar/100)
seekAnimationTime(mixer,elapsed*mul);//elapsed is a time scale running from 0 to 1
}
在blender中,我的动画总长度为250ms。
但是当我将 运行 动画播放到
mixer.time = 100/1000;
只播放了一部分动画
mixer = new THREE.AnimationMixer(cube);
gltf.animations.forEach((clip) => {
mixer.clipAction(clip).play();
});
});
...
function seekAnimationTime(animMixer, timeInSeconds){
animMixer.time=0;
for(var i=0;i<animMixer._actions.length;i++){
animMixer._actions[i].time=0;
}
animMixer.update(timeInSeconds)
}
如何制作动画 运行 某个 "frame" 或 blender 单位的时间?
感谢任何帮助。
使用
var duration = 0;
...
mixer = new THREE.AnimationMixer(cube);
gltf.animations.forEach((clip) => {
duration = clip.duration;
mixer.clipAction(clip).play();
});
...
if(mixer!=null){
var tar = 50; // percentage you want to play to
var mul = duration*(tar/100)
seekAnimationTime(mixer,elapsed*mul);//elapsed is a time scale running from 0 to 1
}