three.js: matrix.extractRotation() returns incorrect rotation matrix when scale is negative
setFromRotationMatrix is incorrect when scale is negative on any axis. matrix.decompose returns correct rotation.
I assume this is because the following code is missing in setFromRotationMatrix (present in matrix.decompose):
// if determine is negative, we need to invert one scale
var det = this.determinant();
if ( det < 0 ) sx = - sx;
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 16 (7 by maintainers)
I would probably prefer to remove it, but I added a comment and patched it, instead.
In your case, are you referring to
QuaternionorEuler?In either case, you have to pass in a pure rotation matrix. (That is where the method name comes from.)
See the code comment: