When using ObjLoader in Three.js to load a *.obj file into my scene, everything works fine. However, I'm uncertain on how to manipulate the object's vertices and indices individually. How can I access the vertices of the loaded *.obj model?
Attempting to execute
var vertex_x = geometry.vertices[0].x
results in an exception stating that property 0 is not defined. Any help on this matter would be greatly appreciated.
var obj_geo = new THREE.OBJLoader();
obj_geo.load('new_I_Profile.obj', function(geometry){
geometry.scale.x = 2; geometry.scale.y = 2; geometry.scale.z = 20;
geometry.rotation.x = -Math.PI/2;
geometry.color = 0xff;
var lines = new THREE.Geometry();
lines.vertices.push(new THREE.Vector3(0, 0, 0));
lines.vertices.push(new THREE.Vector3(0, 120, 0));
var material = new THREE.LineBasicMaterial({ opacity: 1.0, linewidth: 1, vertexColors: THREE.VertexColors });
var main_line = new THREE.Line(lines, material);
main_line.name = 'main_line';
main_line.position.x = crs_line.position.x; main_line.position.z = crs_line.position.z;
main_line.position.y = crs_line.position.y;
main_line.add(geometry);
editor.addObject(main_line);
});