-
Jens Koenen authoredJens Koenen authored
HMD Simulator
The HMD Simulator is an Unreal plugin that emulates a connected HMD and its controllers. Once the plugin is added to your project and enabled, you can start in VR even if you do not have an HMD connected.
Please note, that this cannot replace real testing on an HMD, but allows simple tests without the appropriate hardware at hand.
Adding to your project
Ideally you should add this plugin as a submodule to your project by executing
git submodule add -b 5.3 https://git-ce.rwth-aachen.de/vr-vis/VR-Group/unreal-development/tools/hmd-simulator.git Plugins/HMDSimulator
in the root of your project.
After starting the editor, you should check in Edit->Plugins
if the plugin is enabled.
As this plugin emulates an HMD like any other, you have to add the buttons of the HMD Simulator to the Input Mapping Context files in your project.
If you are using the VR template that comes with Unreal itself, you have to modify the Input Mapping Context files shown in the following image that you can find in the folder Content\VRTemplate\Input\
.
Each Input Mapping Context maps a set of device inputs (e.g. button press) to a set of input actions (e.g. the action to grab an object). As shown in the following image, if you want to control an action with the HMD Simulator, you have to add a mapping that uses a button of the HMD Simulator to the action.
For the Unreal VR template, the following mappings could be used:
IMC_Default
- IA_Grab_Left <-> HMDSimulator (L) Grip Button
- IA_Grab_Right <-> HMDSimulator (R) Grip Button
- IA_Menu_Toggle_Left <-> HMDSimulator (L) Menu Button
- IA_Menu_Toggle_Right <-> HMDSimulator (R) Menu Button
IMC_Hands
- IA_Hand_Grasp_Left <-> HMDSimulator (L) Grip Button
- IA_Hand_Grasp_Right <-> HMDSimulator (R) Grip Button
IMC_Weapon_Left
- IA_Shoot_Left <-> HMDSimulator (L) Trigger Buttom
IMC_Weapon_Right
- IA_Shoot_Right <-> HMDSimulator (R) Trigger Buttom
Configuration
The HMD Simulator uses the keyboard and mouse to grab the input that is needed to emulate the controllers. As the simulator grabs these on a very high level, it catches key presses before your application can. Thus, the keys it uses can be reconfigured to fit your application. This can be done in the options of the Plugin. For this head to Edit->Project Settings->Plugins->HMD Simulator
and configure everything to your liking. You can also change the displayed default controller model and some movement speeds there. Note that the controller model is only displayed if your project does not provide its own.
Usage
Please note, that the keys mentioned in this section only refer to the default configuration
Do a VR Preview launch as shown in the following image
and you will see something similar to this:
Currently, the HMD Simulator emulated the two controllers and the position of the HMD.
If SteamVR is running and a real HMD is detected it is used instead. If you want to explicitly use the HMDSimulator, switch off your HMD or unplug it and close SteamVR. Then restart Unreal und do a VR Preview launch.
Camera Movement
You can move around with the Mouse + WASD
Controller Movement
You can select a controller to control with either LeftShift (Left Controller) or LeftAlt (Right Controller) or both at the same time. Once selected one or both controllers you can move them with the mouse on an orbit around you. You can also alter the radius of this orbit via the ScrollWheel. If you hold the Right-Mouse-Button you switch to rotation mode and the Mouse controls Pitch+Yaw of the controllers and the MouseWheel controls roll.
Controller Buttons
The emulated controllers also offer 3 virtual buttons at the moment. The Trigger, Grab and Menu Button. These can be controlled with T, G or M respectively. If you select a controller (or more) and press one of these keys the controller sends a respective button press to Unreal, that you can use in your Blueprints (ideally via ActionMappings, see Configuration). If setup correctly you can e.g. Grab objects in the world and move them:
Packaging
The HMD Simulator can be packed together with your game and only turns on, if you launch your game in VR mode (commandline parameter -vr
) and additionally provide the -hmd-simulator
parameter.