【发布时间】:2020-06-01 18:53:18
【问题描述】:
从显示静态网格(工作正常)到动画网格(混合结果)时,我遇到了一些错误。我怀疑我一直导出到 glTF 的 fbx 是错误的,但我想问一下:
首先,您如何确定 glTF 文件是否有动画数据/剪辑?而且,如果显示的模型没有任何动画,调用AnimationMixer会导致任何问题吗?
这就是我所拥有的:
// Mix and animate!
mixer = new THREE.AnimationMixer( model );
var clips = model.animations;
// if there's no first animation; there's no animation
if (mixer.clipAction( gltf.animations[ 0 ] ) == undefined)
// if (clips == undefined) // doesn't seem to work
{
// console.log("-> clips " + clips);
console.log("-> no anim for " + model.name);
}
else
{
mixer.clipAction( gltf.animations[ 0 ] ).play();
}
只是偶尔在静态网格上我会收到错误TypeError: Cannot read property 'uuid' of undefined 这让我有点困惑。
【问题讨论】: