我有一个 Threejs 动画混合器,设置如下:
this.mixer = new THREE.AnimationMixer(this.object);
this.mixer.timeScale = 2; //play twice as fast
this.mixer.addEventListener('finished', this.handlePullAnimFinished);
this.pullAnim = this.mixer.clipAction(this.animations[0]);
this.pullAnim.clampWhenFinished = true;
this.pullAnim.setLoop(THREE.LoopOnce);
this.pullAnim.enable = true;
但如果我尝试执行类似 this.mixer.setTime(0.5)
的操作,然后可选地执行 this.mixer.update()
,则什么也不会发生
如何以编程方式将混合器设置为动画中的特定点(并且不让它自动播放)?
我已经看过文档 here关于将动画设置为自动播放(并成功使其工作)
最佳答案
乍一看,您的错误似乎是 .update()
中没有任何参数。
According to the docs ,混合器期望更新方法在每一帧上以秒为单位接收变化。
根据this demo你可以这样做:
var clock = new THREE.Clock();
function animate() {
var dt = clock.getDelta();
mixer.update( dt );
renderer.render( scene, camera );
requestAnimationFrame( animate );
}
关于animation - Threejs Mixer 未更新为 `setTime`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61740354/