When trying to load the .obj file:
loader.load( 'test.obj', function ( objMesh ) {
objMesh.traverse( function ( child ) {
if ( child instanceof THREE.Mesh ) {
child.material = mat2;
}
} );
I attempted to determine the position using mrdoobs code:
objMesh.geometry.computeBoundingBox();
var boundingBox = objMesh.geometry.boundingBox;
var position = new THREE.Vector3();
position.subVectors( boundingBox.max, boundingBox.min );
position.multiplyScalar( 0.5 );
position.add( boundingBox.min );
position.applyMatrix4( objMesh.matrixWorld );
alert(position.x + ',' + position.y + ',' + position.z);
However, I encountered the following error:
objMesh.geometry is undefined
Does this mean it is not possible with loaded meshes?