I have been working on mapping lat/long data to a sphere. I am successfully generating vectors with different positions and setting the cube mesh position accordingly. However, when I merge and display the cubes, it seems like there is only one cube showing up. It appears that all the cubes are located at the same position. I'm trying to figure out where I might be making a mistake in my code. (latLongToSphere function returns a vector);
// this function converts the data into markers displayed on the screen
function renderData() {
// create geometry to hold all the cubes
var geom = new THREE.Geometry();
// add material for non-reflective cubes
var cubeMat = new THREE.MeshLambertMaterial({color: 0xffffff, opacity: 0.6, emissive: 0xffffff});
for (var i = quakes.length - 1; i >= 0; i--) {
var objectCache = quakes[i]["geometry"]["coordinates"];
// calculate starting position for the cube
var position = latLongToSphere(objectCache[0], objectCache[1], 600);
// create the cube
var cubeGeom = new THREE.BoxGeometry(2, 2, 2000, 1, 1, 1),
cube = new THREE.Mesh(cubeGeom, cubeMat);
// set cube's position correctly
cube.position.set(position.x, position.y, position.z);
cube.lookAt(new THREE.Vector3(0, 0, 0));
// merge with main model
geom.merge(cube.geometry, cube.matrix);
}
// create a new mesh containing all the merged meshes
var combined = new THREE.Mesh(geom, cubeMat);
// add the total mesh to the scene
scene.add(combined);
}