SHARE
TWEET

Conv Matrix To pos n rot

a guest Jun 16th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.             // lets say we have a view matrix
  2.             Matrix4x4 matCameraToWorldMatrix = new Matrix4x4();
  3.            
  4.             // get inverse col for rotation calculation
  5.             var inverse = -matCameraToWorldMatrix.GetColumn(2);
  6.  
  7.             // calculate pos and rot from view matrix
  8.             Vector3 position = matCameraToWorldMatrix.GetColumn(3);
  9.             Quaternion rotation = Quaternion.LookRotation(inverse, matCameraToWorldMatrix.GetColumn(1));
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top