Hi team,
I have an issue relating to correctly retrieve data from an array.
I stored positional data (x,y,z) from an object geometry that has child geometry .
the array is created:
var objectMidpoints=[];
i store the position (midpoint of each child geometry) by:
objectMidpoints.push(getCenterPoint(child));
this happens in the loop of :
object.scene.traverse( function ( child ) {
if ( child.isMesh ) {
…
}
}
when i run the page and inspect the data is stored in the objectMidpoints[] array
though when i want to access the data to draw spheres on those midpoint positions i fail to access the array correctly. currently i try to access it by using a for loop :
sphereX.position.set( 12, 10, objectMidpoints[i].y );
This is failing, some pinpointers of how to access the datapoints from teh array correctly would be of great help.