From 466d068089ed49252f3e39a803fedf15556e6e3e Mon Sep 17 00:00:00 2001 From: Baruch Tabanpour Date: Fri, 22 May 2026 11:14:11 -0700 Subject: [PATCH] MuJoCo Studio: Support Ctrl+Option+Left Click Drag for perturbation Support Ctrl+Option+Left Click Drag (maps to Ctrl+Alt+Left Click Drag in the application) to apply point force perturbations (translation) on the robot in the WebGL live viewer. This matches the Mac experience in the native MuJoCo simulate app and provides a fallback for Mac users where Right Click is difficult to trigger. PiperOrigin-RevId: 919767954 Change-Id: I4a1d1c05784a8257d13f64f738af5b4841a615b3 --- src/experimental/studio/app.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/experimental/studio/app.cc b/src/experimental/studio/app.cc index cf7d28e9..b221fa61 100644 --- a/src/experimental/studio/app.cc +++ b/src/experimental/studio/app.cc @@ -461,14 +461,20 @@ void App::HandleMouseEvents() { if (perturb_.select > 0) { mjtMouse action = mjMOUSE_NONE; if (ImGui::IsMouseDown(ImGuiMouseButton_Left)) { - action = io.KeyShift ? mjMOUSE_ROTATE_H : mjMOUSE_ROTATE_V; + if (io.KeyAlt) { + action = io.KeyShift ? mjMOUSE_MOVE_H : mjMOUSE_MOVE_V; + } else { + action = io.KeyShift ? mjMOUSE_ROTATE_H : mjMOUSE_ROTATE_V; + } } else if (ImGui::IsMouseDown(ImGuiMouseButton_Right)) { action = io.KeyShift ? mjMOUSE_MOVE_H : mjMOUSE_MOVE_V; } else if (ImGui::IsMouseDown(ImGuiMouseButton_Middle)) { action = mjMOUSE_ZOOM; } const mjtPertBit active = - action == mjMOUSE_MOVE_V ? mjPERT_TRANSLATE : mjPERT_ROTATE; + (action == mjMOUSE_MOVE_V || action == mjMOUSE_MOVE_H) + ? mjPERT_TRANSLATE + : mjPERT_ROTATE; if (active != perturb_.active) { platform::InitPerturb(model(), data(), &camera_, &perturb_, active); }