Camera in XML and Unity

Discussion in 'Unity Plugin' started by macw, Jul 24, 2019.

  1. Hi all! In mjremote.py, there are setcamera and getimage functions. Do they refer to the cameras in Unity or the ones declared in the xml?

    Also, if I would like to set the camera orientation with global rotation matrices (cam_xmat) I obtained from other simulation, how should I approach this? I tried to pass the xmat to Unity and create the quaternion in MJRemote.cs. But the orientation and transform don't give me the same orientation as I had in MuJoCo.

    Any help would be greatly appreciated. Thank you!!!
     
  2. After struggling for a few days, I realised the actual conversion is done in the MJRemote.cs file. I only need to tweak the code a bit as follows:

    Quaternion q = new Quaternion(0, 0, 0, 1);
    q.SetLookRotation(
    new Vector3(xmat[2], -xmat[8], xmat[5]),
    new Vector3(-xmat[1], xmat[7], -xmat[4])
    );