Camera that targets a body with angle offset

Discussion in 'Simulation' started by macw, Jul 11, 2019.

  1. I have setup a camera under worldbody that targets a body. It works perfectly.

    Now, I want to change the angle of the camera by a bit in each frame. In other words, I want the camera to look at the body and has an angle offset. I tried changing cam_quat in mjModel but it doesn't reflect in the rendering. I should also mention that I am changing the position of the camera in each frame via changing cam_pos in _mjModel.

    What other approach can I take?

    The camera setting:
    <camera name="camera1" pos="0 -10 10" mode="targetbody" target="box"/>
     
  2. Ok, I managed to change the orientation by editing sim.data.cam_xmat. This may not be ideal but it works for now. Please let me know if there is a better way!