I have a THREE.PlaneGeometry
, with ComputeFaceNormals()
. I create two meshes using this geometry, with different rotations applied to them. I want to compute the two angles between the camera and the two meshes central face normal. It should be :
vLocalCamera = vCamera.position - mesh1.position;
mesh1.normal() . vLocalCamera = cos(angle);
The problem is that I don't know how to get the mesh normal in world coordinate (from geometry and mesh rotation) with three.js API
If you want to convert a face or vertex normal, normal
, from local space to world space, you do it like so:
var normalMatrix = new THREE.Matrix3(); // create once and reuse
var worldNormal = new THREE.Vector3(); // create once and reuse
...
normalMatrix.getNormalMatrix( object.matrixWorld );
worldNormal.copy( normal ).applyMatrix3( normalMatrix ).normalize();
three.js r.107