Advertisement
Guest User

Conv Matrix To pos n rot

a guest
Jun 16th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.46 KB | None | 0 0
  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));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement