From 428e54d2aadc949072a438a9eb6400efe09da382 Mon Sep 17 00:00:00 2001 From: Pierre Gergondet Date: Thu, 9 Nov 2023 10:17:08 +0900 Subject: [PATCH] Support MuJoCo 3.0.0 --- .github/workflows/ci.yml | 2 +- src/mj_utils.cpp | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c2e7ff..cbbf51d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,7 +55,7 @@ jobs: set -e mkdir -p /opt cd /opt - MUJOCO_VERSION=2.3.7 + MUJOCO_VERSION=3.0.0 wget --quiet https://github.com/deepmind/mujoco/releases/download/${MUJOCO_VERSION}/mujoco-${MUJOCO_VERSION}-linux-x86_64.tar.gz tar xzf mujoco-${MUJOCO_VERSION}-linux-x86_64.tar.gz mv mujoco-${MUJOCO_VERSION} mujoco diff --git a/src/mj_utils.cpp b/src/mj_utils.cpp index 11e6ead..8a44b1d 100644 --- a/src/mj_utils.cpp +++ b/src/mj_utils.cpp @@ -197,11 +197,20 @@ void uiEvent(mjuiState * state) // find geom and 3D click point, get corresponding body mjrRect r = state->rect[0]; mjtNum selpnt[3]; - int selgeom, selskin; + int selgeom; + int selskin; +#if mjVERSION_HEADER < 300 int selbody = mjv_select(mj_sim->model, mj_sim->data, &mj_sim->options, (mjtNum)r.width / (mjtNum)r.height, (mjtNum)(state->x - r.left) / (mjtNum)r.width, (mjtNum)(state->y - r.bottom) / (mjtNum)r.height, &mj_sim->scene, selpnt, &selgeom, &selskin); +#else + int selflex; + int selbody = + mjv_select(mj_sim->model, mj_sim->data, &mj_sim->options, (mjtNum)r.width / (mjtNum)r.height, + (mjtNum)(state->x - r.left) / (mjtNum)r.width, (mjtNum)(state->y - r.bottom) / (mjtNum)r.height, + &mj_sim->scene, selpnt, &selgeom, &selflex, &selskin); +#endif // set lookat point, start tracking is requested if(selmode == 2 || selmode == 3)