I'm struggling with animating in Three.js and I can't figure out if the issue lies in my code or my blender file.
Below is the code that I'm using to load and animate the model. Please review it and let me know if you spot any errors.
loader.load('model.js', function (geometry, materials) {
var mesh, material;
mesh = new THREE.SkinnedMesh(
geometry,
new THREE.MeshFaceMaterial(materials)
);
material = mesh.material.materials;
for (var i = 0; i < materials.length; i++) {
var mat = materials[i];
mat.skinning = true;
}
scene.add(mesh);
THREE.AnimationHandler.add(mesh.geometry.animation);
animation = new THREE.Animation(
mesh,
'ArmatureAction',
THREE.AnimationHandler.CATMULLROM
);
animation.play();
Many thanks in advance!