Mouse Interaction
Advanced depth-aware mouse interaction for navigating a scene.
Provides rotation, panning and zooming controls that are relative to depth at mouse cursor for more convenient interaction with complex scenes. See also the ArcBall Camera example for an alternative approach.
Controls
Behavior similar to Blender with Zoom To Mouse Position enabled.
- mouse drag rotates the scene around the cursor
- Shift mouse drag pans the scene at depth of the cursor
- mouse wheel zooms in/out relative to cursor position
- Num 1 / Ctrl Num 1 switches to a front / back view
- Num 3 / Ctrl Num 3 switches to a right / left view
- Num 7 / Ctrl Num 7 switches to a top / bottom view
- Num 0 resets the camera back to the original view
Credits
This example was originally contributed by @scturtle.
Source
Full source code is linked below and also available in the magnum-examples GitHub repository.
The ports branch contains additional patches for Emscripten support that aren't present in master
in order to keep the example code as simple as possible. Code from this example is used in full in the magnum-player app.