no vertices in the IcosahedronGeometry
abdulsalamalmahdi opened this issue · comments
abdulsalamalmahdi commented
in the video for drawing cricles into IcosahedronGeometry
when trying to access the vertices array on the IcosahedronGeometry objects it is undifined the array does noto exist.
s-huh commented
hey @abdulsalamalmahdi, I came across the same problem when following Matt's tutorial. The latest version of ThreeJS does not seem to allow an array of vertex coordinates to be accessed directly from the geometry i.e. new THREE.SomeGeometry().vertices
. Instead I used the below workaround to extract vertices:
const someGeometry = new THREE.SomeGeometry();
const positionAttribute = someGeometry.getAttribute('position');
const vertices = [];
for ( let vertexIndex = 0; vertexIndex < positionAttribute.count; vertexIndex ++ ) {
point = new THREE.Vector3().fromBufferAttribute( positionAttribute, vertexIndex );
vertices.push(point);
}
Hope that helps