(self, action, grab_pos)
Starts a movement action.
Starts a movement action.
Starts a movement action .
def start_move(self, action, grab_pos):
    """Starts a movement action."""
    if action is None or grab_pos is None:
      return

    mjlib.mjv_initPerturb(self._model.ptr, self._data.ptr, self._scene.ptr,
                          self._perturb.ptr)
    self._action = action
    move_actions = np.array([enums.mjtMouse.mjMOUSE_MOVE_V,
                             enums.mjtMouse.mjMOUSE_MOVE_H])
    if any(move_actions == action):
      self._perturb.active = enums.mjtPertBit.mjPERT_TRANSLATE
    else:
      self._perturb.active = enums.mjtPertBit.mjPERT_ROTATE

    body_pos = self._data.xpos[self._body_id]
    body_mat = self._data.xmat[self._body_id].reshape(3, 3)
    grab_local_pos = body_mat.T.dot(grab_pos - body_pos)
    self._perturb.localpos[:] = grab_local_pos
def start_move ( self , action , grab_pos ) : if action is None or grab_pos is None : return mjlib . mjv_initPerturb ( self . _model . ptr , self . _data . ptr , self . _scene . ptr , self . _perturb . ptr ) self . _action = action move_actions = np . array ( [ enums . mjtMouse . mjMOUSE_MOVE_V , enums . mjtMouse . mjMOUSE_MOVE_H ] ) if any ( move_actions == action ) : self . _perturb . active = enums . mjtPertBit . mjPERT_TRANSLATE else : self . _perturb . active = enums . mjtPertBit . mjPERT_ROTATE body_pos = self . _data . xpos [ self . _body_id ] body_mat = self . _data . xmat [ self . _body_id ] . reshape ( 3 , 3 ) grab_local_pos = body_mat . T . dot ( grab_pos - body_pos ) self . _perturb . localpos [ : ] = grab_local_pos