I created a Mesh in blender, exported it and loaded it via the JSON loader. Everything is rendered perfectly in the scene, but when I try to access it from outside the loader's callback function, I always get an "undefined".
This is my code:
var mesh, material;
var loader = new THREE.JSONLoader();
loader.load("./models/Baccanti/Bac.js", addModelToScene);
function addModelToScene(geometry,materials){
material = new THREE.MeshFaceMaterial(materials);
mesh = new THREE.Mesh(geometry,material);
mesh.position.set(0,0,0);
scene.add(mesh);
}
What do I miss or how do I access the mesh after loading?
Thank you!