Hello,
I’m trying to get the world position of the vertices in my model using geometry.vertices. but it returns undefined for me.
I found this issue on SO https://stackoverflow.com/questions/11495089/how-to-get-the-absolute-position-of-a-vertex-in-three-js talking about it, but even using the method as described by WestLangley it will still return undefined.
I load my obj using the THREE.OBJLoader, and it loads correctly. I try to get the vertice position using the following code:
object.traverse( function ( child ) { // child is the mesh
if ( child instanceof THREE.Mesh ) {
child.material.emissive.set(0xff00ff);
console.log("vertices: ", child.geometry.vertices);//returns undefined
for(var i = 0; i < child.geometry.vertices.length; i++){//Cannot read property 'length' of undefined
var vector = child.geometry.vertices[i].clone();
vector.applyMatrix4( child.matrixWorld );
console.log(vector);
}
}
Am i missing something here?
Thanks for your time.
-Remy