1

I have a group of THREE.Mesh objects. My goal is to use something like group.applyMatrix( new THREE.Matrix4().makeRotationX( Math.PI / 2) );. Then, I would like to make the result as the group default matrix, so that I can use matrixUpdate() in my animation.

In ThreeJS docs, we can find: "Calling updateMatrix will clobber the manual changes made to the matrix, recalculating the matrix from position, scale, and so on."

Is there a way to make the manual changes I want and then set the result as if it was the default state of group?

WestLangley
  • 102,557
  • 10
  • 276
  • 276
Bruno Lima
  • 33
  • 1
  • 5

1 Answers1

2

Based on @WestLangley related answer, here is the solution for my problem! After executing all the matrix transformations I want, I just needed to do:

group.children.forEach( function(mesh) {
    mesh.geometry.applyMatrix( group.matrix );
});
group.updateMatrix();
Community
  • 1
  • 1
Bruno Lima
  • 33
  • 1
  • 5
  • This is updating the vertices of the geometry. Maybe what you want, instead, is `mesh.applyMatrix( group.matrix );`. – WestLangley Mar 22 '16 at 21:57
  • 1
    @WestLangley I needed to update the geometry for my purposes... In this case, I wanted to correct the rotation of an object made of a group of meshes – Bruno Lima Mar 24 '16 at 14:47