Reputation: 1229
How is it possible to add the same dae model to a scene more than once?
//loading collada model
var soldiers = [];
var loader = new THREE.ColladaLoader();
loader.options.convertUpAxis = true;
loader.load('soldier.dae', function(collada) {
var dae = collada.scene;
for(var i=0; i<10; i++){
var new_soldier = new THREE.Mesh( dae.geometry, dae.material );
soldiers.push(new_soldier);
scene.add(new_soldier);
}
});
The error is: dae.geometry
and dae.material
is undefined.
I have no Idea how to solve it.
Thanks in advance,
Upvotes: 0
Views: 1502
Reputation: 12632
The collada.scene
variable is instanceof Object3D
so it does not have geometry or material attributes. What you need to do is to replace the for loop with:
for(var i=0; i<10; i++)
scene.add( dae );
Upvotes: 1