Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // lets say we have a view matrix
- Matrix4x4 matCameraToWorldMatrix = new Matrix4x4();
- // get inverse col for rotation calculation
- var inverse = -matCameraToWorldMatrix.GetColumn(2);
- // calculate pos and rot from view matrix
- Vector3 position = matCameraToWorldMatrix.GetColumn(3);
- Quaternion rotation = Quaternion.LookRotation(inverse, matCameraToWorldMatrix.GetColumn(1));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement