mjv_moveModel

Discussion in 'Simulation' started by Edward Fang, Jun 14, 2017.

  1. What is the roomup variable supposed to be? How do I move an object with my mouse?
     

    Attached Files:

  2. Emo Todorov

    Emo Todorov Administrator Staff Member

    This function is used in VR to move the entire model (i.e. adust mjvScene.translate, rotate, scale) relative to the room coordinate frame. The argument "roomup" is a 3D vector specifying the up direction of the motion capture coordinate frame. This is usually (0,0,1) but could be something else depending calibration. When using the HTC Vive or Oculus, it is always (0,0,1) because they have a built-in accelerometer which measures the direction of gravity. But professional mocap systems (Vicon etc) do not have that, so their coordinate frame is not always aligned with the room.

    Anyway, if you want to move an object, this is not the right function. Look at the code sample simulate.cpp. When paused, it allows you to move the selected obiect with the mouse. This is done by creating a perturbation object (mjvPerturb), moving it around with the mouse (mjv_movePerturb) and instantiating the perturb object pose to the selected body (mjv_applyPerturbPose).
     
  3. Thank you!