matrix.extractRotation() returns incorrect rotation matrix when scale is negative
See original GitHub issuesetFromRotationMatrix 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;
Issue Analytics
- State:
- Created 5 years ago
- Comments:16 (7 by maintainers)
Top Results From Across the Web
Given this transformation matrix, how do I decompose it into ...
Extract Rotation Divide the first three column vectors by the scaling factors you just found. Your matrix should now look like this (remember...
Read more >Reset rotation matrix without losing scale - Stack Overflow
Most of the rotate() methods out there add rotation to a current one multiplying the current matrix with the new rotation. I need...
Read more >How to assign Matrix4x4 to Transform? - Unity Forum
Do I really have to extract position, rotation, and scale values from the matrix, or there is a nice and simple way to...
Read more >Struct Matrix4d - OpenTK
Represents a 4x4 matrix containing 3D rotation, scale, transform, and projection with double-precision components. Implements. System.IEquatable<Matrix4d> ...
Read more >hou.Matrix4 - SideFX
A 4×4 matrix of floating point values. 4×4 matrices are typically used in Houdini to represent a 3D transformation (e.g. some combination of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I would probably prefer to remove it, but I added a comment and patched it, instead.
In your case, are you referring to
Quaternion
orEuler
?In either case, you have to pass in a pure rotation matrix. (That is where the method name comes from.)
See the code comment: