I'm attempting to convert a Matrix4x4 which is being currently being applied to a camera using camera.worldToCameraMatrix and works fine.
I'm able to get the position out with:
But at the moment can't get the quaternion to come out. I've pulled some code from a matrix and quaternion FAQ I stumbled across and have partially implemented, but at the moment its not behaving.
If I turn off the camera.worldToCameraMatrix, and rely on the Vector and Quaternion I get out (ignoring cases where it gets to the 'more to calculate here') the position of the camera looks fine, but its rotation is way off.
asked Feb 11, 2010 at 07:15 AM
For getting a quaternion from a Matrix4x4, this function works:
For getting the position, GetColumn(3) works fine.
answered Feb 11, 2010 at 11:08 AM
Actually I can confirm that the
Doesn't work, and the
I'm making a voxel engine that performs all sorts of transforms and the first method produces:
While the second función produces
And the control test uses Graphics.DrawMesh() with the matrix transform as a parameter