In the code below, what are the different impacts on obj when using
- box.getCenter(obj.position), and when using
- obj.geometry.center()
If I comment one or the other I get different results but I have hard time to define the changes.
Also, if I want to see the absolute vertices of the object.geometry, I can call
obj.updateMatrixWorld();
for(var i=0;i<obj.geometry.vertices.length;i++){
obj.geometry.vertices[i].applyMatrix4( obj.matrixWorld );
}
obj.geometry.verticesNeedUpdate = true;
In such case, do I need to reset the obj.position? (or else, the absolute vertices will get updated to new values in every frame?)
Thanks,
Avner
obj=new THREE.Mesh(
new THREE.PlaneGeometry(3, 2, 1, 1),
new THREE.MeshLambertMaterial({color:0x00aa00,transparent:true,side:THREE.DoubleSide})
);
obj.geometry.translate(3,2,0);
obj.position.copy(new THREE.Vector3(3.0, 2, 0.0));
var box = new THREE.Box3().setFromObject( obj );
box.getCenter( obj.position ); // this re-sets the obj position
obj.geometry.center();