This repository has been archived by the owner on Dec 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Coordinate systems
donghokang edited this page Nov 27, 2019
·
2 revisions
Unity is left-handed coordinate system with y-axis-up world frame while RaiSim is right-handed coordinate system with z-axis-up frame.
We follow RaiSim coordinate system to visualize RaiSim world. This can be done by the following code:
public static void SetTransform(GameObject obj, Vector3 rsPos, Quaternion rsQuat)
{
// rsPos is position in RaiSim
// rsQuat is quaternion in RaiSim
var yaxis = rsQuat * new Vector3(0, 1.0f, 0);
var zaxis = rsQuat * new Vector3(0, 0, 1.0f);
Quaternion q = new Quaternion(0, 0, 0, 1);
q.SetLookRotation(
new Vector3(yaxis[0], -yaxis[2], yaxis[1]),
new Vector3(-zaxis[0], zaxis[2], -zaxis[1])
);
obj.transform.localPosition = new Vector3(-rsPos.x, rsPos.z, -rsPos.y);
obj.transform.localRotation = q;
}
In a short, we set Unity objects position as (-xRS, zRS, -yRS) where subscript RS indicates RaiSim position.
Copyright (c) 2019, Dongho Kang, Robotics Systems Lab, ETH Zurich.