You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
publicstaticvoidSetTransform(GameObjectobj,Vector3rsPos,QuaternionrsQuat){// rsPos is position in RaiSim// rsQuat is quaternion in RaiSimvaryaxis=rsQuat*newVector3(0,1.0f,0);varzaxis=rsQuat*newVector3(0,0,1.0f);Quaternionq=newQuaternion(0,0,0,1);q.SetLookRotation(newVector3(yaxis[0],-yaxis[2],yaxis[1]),newVector3(-zaxis[0],zaxis[2],-zaxis[1]));obj.transform.localPosition=newVector3(-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.