我正在尝试使用three.js为3d对象设置动画。我确实拥有加载在对象几何体中的骨骼结构;每个骨骼都有父,pos,rotq,scl。此外,几何体还会获得负责蒙皮的skinIndices和skinWeights。创建动画以尊重结构:
animation: {
name: "nameOfAnimation",
length: 1201,
fps: 0.03, // fpms actually
hierarchy: [
{ parent: -1,
keys: [
{ time: 0,
pos: [ x, y, z ],
rot: [ x, y, z, w ],
scl: [ x, y, z ] },
{ time: 620,
rot: [ x, y, z, w ] },
{ time: 1201,
pos: [ x, y, z ],
rot: [ x, y, z, w ],
scl: [ x, y, z ] } ] },
{ parent: 0,
keys: [ ...
] }
但是,在设置了所有结构的情况下,对象不会被动画化。
以下是代码的主要部分:
//setting up geometry with geometry.bones, geometry.skinWeights, geometry.skinIndices
//setting up animation following the format described above
skinMaterial = new THREE.MeshBasicMaterial({skinning: true});
skinMesh = new THREE.SkinnedMesh(geometry, skinMaterial);
skinAnimation = new THREE.Animation(skinMesh, animation);
skinAnimation.play();
我有什么问题吗?