Window interaction#
This section describes the default window interaction controls available in the simulation. These controls allow users to interact with the simulation environment using keyboard, mouse, and customizable input events.
The main visualization window is provided by DexSim. When SimConfig.headless=False or SimulationManager.open_window() is called, DexSim creates the viewer with ORBIT camera control by default.
Default Window Controls#
Mouse Controls#
Input |
Operation |
|---|---|
Left drag / Middle drag |
Rotate around the current target point. |
Right drag |
Pan the camera and target together. |
Mouse wheel |
Dolly the camera closer to or farther from the target. |
Keyboard Controls#
Input |
Operation |
|---|---|
Space |
Reset the window camera to its home view. |
Left Ctrl + W / S |
Temporarily translate the view forward / backward. |
Left Ctrl + A / D |
Temporarily translate the view left / right. |
Left Ctrl + Q / E |
Temporarily translate the view down / up. |
In ORBIT mode, plain W/A/S/D/Q/E does not move the view. Hold Left Ctrl while pressing those keys to translate both the camera eye and target.
Selection and Focus#
Input |
Operation |
|---|---|
Left click |
Select the object under the cursor in the main visualization window. |
F |
Focus the selected object and frame it in the view. |
L |
Toggle selection log output in the terminal. Selection logs are disabled by default. When enabled, left-clicking an object prints its id, name, world position, and rotation. |
EmbodiChain Extensions#
Input |
Operation |
|---|---|
Viewer recording (toggle) |
Press |
Recording hotkey registration is controlled by SimConfig.window_record.enable_hotkey (enabled by default). You can also call SimulationManager.start_window_record(), stop_window_record(), or toggle_window_record() programmatically.
Customizing Window Events#
Users can create their own custom window interaction controls by subclassing the ObjectManipulator class (provided by dexsim). This allows for the implementation of specific behaviors and responses to user inputs.
Here’s an example of how to create a custom window event that responds to key presses:
from dexsim.engine import ObjectManipulator
from dexsim.types import InputKey
class CustomWindowEvent(ObjectManipulator):
def on_key_down(self, key):
if key == InputKey.SPACE.value:
print("Space key pressed!")
# Assuming you already have a SimulationManager instance called `sim_manager`
# (for example, created elsewhere in your code):
# sim_manager = SimulationManager(...)
# Register the custom window event handler with the simulation:
sim_manager.add_custom_window_control([CustomWindowEvent()])
The functions table below summarizes the key methods available in the ObjectManipulator class for customizing window events:
Method |
Description |
|---|---|
|
Triggered when a key is pressed down. The |
|
Triggered when a key is released. The |
|
Triggered when the mouse is moved. The |
|
Triggered when a mouse button is pressed. The |
|
Triggered when a mouse button is released. The |
|
Triggered when the mouse wheel is scrolled. The |
|
When enabled, caches the last raycast selection so |