Multi animations from Blender / JSON

json
loaders
blender-exporter
animation

#1

I can’t seem to get this JSON model to animate in three.js. I’ve tried exporting it so many different ways using the three exporter, but I’m not sure if it’s the model or the code. I’m getting a trace on the animations from within the model (5), but nothing happens on the call-back. Any ideas?

new THREE.JSONLoader().load( 'assets/model/Gunnar.json', function ( model, material ) {

var mesh = new THREE.SkinnedMesh(model, material);
scene.add( mesh );
mesh.scale.x = mesh.scale.y = mesh.scale.z = 5;
var clips = model.animations;
mixer = new THREE.AnimationMixer( mesh );
mixer.clipAction( clips[0] ).play();

loaded = true;
animate();
} );


function animate() {
requestAnimationFrame( animate );
if (loaded) {
mixer.update(clock.getDelta());
}
renderer.render( scene, camera );
}

Blender / JSON Test files


Blender 2.78
Three.js R88


#2

@electricenjin
Hi it’s fixed: (FinalGunnar.json)
https://dl.dropbox.com/s/1py665164r43hfw/Gunnars.zip

few tips:
-Untick this part when exporting unless you want to use new THREE.ObjectLoader
-select only the model you want to export in pose mode, note do not select armature just the model
-you don’t need the blendshape


#3

Thanks for the tips!

I’m still having trouble getting the animations to play. Any thoughts?


#4

it’s working on my side
try this:


#5

Still no dice, I’ve posted my file here using the latest FinalGunnar.json you sent over. I really appreciate the help!

http://165.227.178.23/gunnartest.html


#6

you didn’t define your material

here it’s fixed:

https://jsfiddle.net/eqa29e3a/1/


#7

Amazing! Thanks @Waverider