animation - Threejs Mixer 未更新为 `setTime`

标签 animation three.js 3d gltf

我有一个 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/

相关文章:

3d - 建议在Ogre,Irrlicht和OpenSceneGraph之间使用哪种C++ 3D引擎更好

animation - react-native:禁用动画

Java Swing 尝试用矩形制作一个小动画

c# - Monotouch CGAffineTransform,在同一 View 上同时为多个仿射变换设置动画

javascript - three.js 看起来很奇怪的影子

three.js - 在 Three.js 中使用 OBJMTLoader 的 WebGL 导入模型失败

css - 如何定义css动画?

javascript - 获取相机三js中两个物体的距离

javascript - 在粒子系统中渲染球体(或点)

opengl - WebGL 的酷应用程序?