Reputation: 321
Whats the proper way to apply a rotation from a Mesh to a THREE.Box3 Object? I saw that Box3 has an applyMatrix function so I tried to apply a Matrix from the Meshs rotation which i created with:
var mat4 = new THREE.Matrix4().makeRotationFromEuler(obj3d.rotation)
box3.applyMatrix4(mat4)
but the rotation / position won't match the mesh.
Upvotes: 3
Views: 2093
Reputation: 12642
You need to get the global transform of the object and then apply it to the bbox.
var mat4 = new THREE.Matrix4();
mat4.extractRotation( obj3d.matrixWorld );
box3.applyMatrix( mat4 );
Upvotes: 1