Add keyboard shortcuts, body selection, and drag perturbation#21
Draft
kevinzakka wants to merge 2 commits into
Draft
Add keyboard shortcuts, body selection, and drag perturbation#21kevinzakka wants to merge 2 commits into
kevinzakka wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WIP. Interactive features to bring the viewer closer to MuJoCo simulate.
Keyboard shortcuts for simulation control (space=pause, N=step, backspace=reset) and visualization toggles (C=contacts, F=forces, J=joints, I=inertia, V=tendons, M=COM, U=actuators, T=constraints). Camera selection via dropdown. Speed control is command-palette only to avoid clashing with viser's built-in camera keys (WASD, QE, arrows).
Click a body to select it (ray cast via mj_ray). Cmd/Ctrl+drag applies a translational spring force, Cmd/Ctrl+Shift+drag applies torque. The force model uses MuJoCo's critically-damped spring scaled by body mass (from body_invweight0), with velocity damping via finite difference. Hover highlighting comes from viser automatically when on_click is registered.
Known issue: viser collapses Cmd and Ctrl into a single "cmd/ctrl" modifier, so on macOS both Cmd+drag and Ctrl+drag activate perturbation. Ctrl+drag also triggers the browser's context menu (macOS translates Ctrl+left-click to right-click). Ideally only Cmd would match on Mac. This needs a viser-side change to support separate "meta" and "ctrl" modifiers.