Animation 如何确定glTF是否有动画数据
从显示静态网格(工作正常)到显示动画网格(混合结果),我遇到了一些错误。我怀疑我一直出口到glTF的fbx是错误的,但我只想问: 首先,如何确定glTF文件是否包含动画数据/片段?而且,如果显示的模型没有任何动画,那么调用Animation 如何确定glTF是否有动画数据,animation,three.js,gltf,Animation,Three.js,Gltf,从显示静态网格(工作正常)到显示动画网格(混合结果),我遇到了一些错误。我怀疑我一直出口到glTF的fbx是错误的,但我只想问: 首先,如何确定glTF文件是否包含动画数据/片段?而且,如果显示的模型没有任何动画,那么调用AnimationMixer会导致任何问题吗 这就是我所拥有的: // Mix and animate! mixer = new THREE.AnimationMixer( model ); var clips = model.animations;
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:无法读取未定义的属性“uuid”
,这让我有点困惑。gltfloader使用结构调用完成函数。。该结构中有一个.animations[]数组。如果为空,则未找到动画。只要你制作了你的混音器,并且没有尝试添加一个未定义的动画,它本身就应该是好的,你可以在以后找到动画时添加它