Is there a way to load a JSON model just once and then add it multiple times to the scene with different scales, positions, etc?
I've tried adding the Object3D() to an array, assigning a position and scale to each object in the array, adding them to the scene, but the position and scale get overwritten for every object in the array.
I'm stuck and hoping someone can provide me with a working example of what I want to achieve.
Here's one of my failed attempts. It should give you an idea of what I'm attempting to do, in case my explanation was unclear.
function addModels(){
var models = [];
var model = new THREE.Object3D();
var modelTex = THREE.ImageUtils.loadTexture( "textures/model.jpg" );
var loader = new THREE.JSONLoader();
loader.load( "models/model.js", function( geometry ) {
mesh = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial({ map: modelTex }) );
model.add(mesh);
} );
for(var i = 0; i < 5; i++){
model.scale.set(i,i,i);
model.position.set(i,i,i);
models[i] = model;
scene.add(models[i]);
}
}