Initially, I thought I wanted a simple, quiet solution, but it turned out to be more complex than I anticipated.
All I'm aiming for are meshes on every vertex of a THREE.BufferGeometry
(specifically a sphere)!
You can view the CODEPEN here: codepen.io/cheesyeyes/pen/YwBZGz
To visualize, here's a reference image of what I'm aiming for: this is what I want to have
This snippet showcases my buffer geometry:
var bufferGeometry = new THREE.SphereBufferGeometry(1,1,1);
My objective is to access the positions of the vertices:
bufferGeometry.getAttribute('position',0);
What I'm struggling with is properly reading out the positions of all (in this scenario, 5) vertices of my bufferGeometry.
I've attempted this approach which does function, but I find it quite messy:
vertexMesh.position.x=position.array[0];
vertexMesh.position.y=position.array[1];
vertexMesh.position.z=position.array[2];
for(i=12;i<position.array.length-9;i=i+3)
{
//vertexGeometry
var vertexGeometry = new THREE.SphereGeometry(0.1,32,32);
var vertexMaterial = new THREE.MeshBasicMaterial({color:0xff0000});
var vertexMesh = new THREE.Mesh(vertexGeometry,vertexMaterial);
vertexMesh.position.x=position.array[i];
vertexMesh.position.y=position.array[i+1];
vertexMesh.position.z=position.array[i+2];
scene.add(vertexMesh);
}
I'm having trouble understanding how this array is structured. Any assistance would be greatly appreciated! Thank you!