Tuesday, 15 May 2012

matrix - Three.js: chaotic mesh rotation after applyMatrix -


After printing the matrix, I print its rotation parameters. After resetting mash rotation, scale and position and re-applying the same matrix - the rotation parameters are not equal to the previous ones.

  var ctm1 = new THREE.Matrix4 (); Var ctm2 = new THREE.Matrix4 (); Ctm1.set (...............); Ctm2.set (...............); Function Reset (Aries) {mesh.position.set (0,0,0); Mesh.scale.set (5,5,5); Mesh.rotation.set (0,0,0); } Reset (MyMesh); MyMesh.applyMatrix (ctm1); Console.log (myMesh.rotation.x); Reset (myMesh); MyMesh.applyMatrix (ctm2); Reset (myMesh); MyMesh.applyMatrix (ctm1); Console.log (myMesh.rotation.x); // is not equal to previous output !!!   

Three. Js r.58

three. Js handles the renderer object to update matrix , so that the matrix object is consistent with the position , rotation , and scale Ho.

Since you do not call render () , you should replace mesh.updateMatrix () as the last line of your Reset () function.

Three. Js r.58

No comments:

Post a Comment