Converting Coordinates and Vectors
To convert a right-handed vector (assuming that z is up) to left-handed vector (Unity coordinate system), simply swap y and z coordinates.
The following is a method that performs this conversion:
private Vector3 ConvertRightHandedToLeftHandedVector (Vector3 rightHandedVector)
{
return new Vector3(rightHandedVector.x, rightHandedVector.z, rightHandedVector.y);
}
Converting Quaternions
To convert a right-handed quaternion to left-handed quaternion:
- Negate x
- Swap y and z and negate both
The following is a method that performs this conversion:
private Quaternion ConvertRightHandedToLeftHandedQuaternion (Quaternion rightHandedQuaternion)
{
return new Quaternion (- rightHandedQuaternion.x,
- rightHandedQuaternion.z,
- rightHandedQuaternion.y,
rightHandedQuaternion.w);
}