Im just trying to load in a model with animations from blender to three js. So Im trying to copy http://stemkoski.github.io/Three.js/Model-Animation.html
I downloaded his code, and he uses:
var jsonLoader = new THREE.JSONLoader();
jsonLoader.load( "models/android-animations.js", addModelToScene );
// addModelToScene function is called back after model has loaded
var ambientLight = new THREE.AmbientLight(0x111111);
scene.add(ambientLight);
}
function addModelToScene( geometry, materials )
{
// for preparing animation
for (var i = 0; i < materials.length; i++)
materials[i].morphTargets = true;
var material = new THREE.MeshFaceMaterial( materials );
android = new THREE.Mesh( geometry, material );
android.scale.set(10,10,10);
scene.add( android );
}
Granted Im working in node JS, but I get error JSONLoader has been removed
when I do:
var jsonLoader = new THREE.JSONLoader();
jsonLoader.load( "./src/scripts/elements/android-animations.js", this.addModelJson);
Ive tried FBXLoader, ObjectLoader, everything. I can load models but not models with animations. Is this the only solution?
If JSONLoader doesn't exist anymore, how can I load in a model with an animation from blender?
UPDATE:
this
is undefined when I use LegacyJSONLoader like this:
var jsonLoader = new THREE.LegacyJSONLoader();
jsonLoader.load( "./src/scripts/elements/android-animations.js", this.addModelJson);
addModelJson( geometry, materials, scene )
{
// for preparing animation
for (var i = 0; i < materials.length; i++)
materials[i].morphTargets = true;
var material = new THREE.MeshFaceMaterial( materials );
var android = new THREE.Mesh( geometry, material );
android.scale.set(10,10,10);
this.scene.add( android );
}