Currently working with Three.js.
What I have:
As shown in the figure and code below i have a for loop that create a specific object on random position in the scene.
//Create Objects
var geometry = new THREE.CylinderBufferGeometry( 0, 10, 30, 4, 1 );
var material = new THREE.MeshPhongMaterial( { color: 0xffffff, flatShading: true } );
for(var i=0; i<100; i++) {
var mesh = new THREE.Mesh( geometry, material );
mesh.position.x = getRandomInt(-500,500);
mesh.position.y = getRandomInt(10, 100);
mesh.position.z = getRandomInt(-500,500);
mesh.updateMatrix();
mesh.matrixAutoUpdate = false;
scene_Main.add( mesh );
}
My Question:
How to create random objects of different material and geometry in a for loop?
Can i use the idea of creating an array that holds the specific geometry/material and if so how to store this in an array and how to use it?
array idea:
var geometryList = [cube, pyramid, sphere, donut, ...];
var materialList = [ .. what posibilities I have here? .. ];
for(var i=0; i<100; i++) {
var mesh = new THREE.Mesh( geometryList[random[n]], materialList[random[n]] );
....
}

