Note on Binding Command to Virtual Controller Event
The VotanicXR command system provide a decoupled and extensible mechanism for developer to separate the application logic to physical input device system.
VotanicXR has several core commands, they are Trigger
, TriggerUp
, TriggerHold
, Grab
, and Menu
. These commands are used in several of VotanicXR’s core features, and are also used by other commands when different in-game tools are enabled. It is required to assign virtual controller button to these commands so that VotanicXR work properly. In the VotanicXR, the first two virtual controllers (Controller[0] and Controller[1]) in the VotanicXR Configurator are reserved for the 5 pre-mapped common devices introduced here. For these 5 common devices, the command to virtual controller event binding is pre-defined as follows:
a) The common device that’s connected to the system are automatically assigned to the Controller[0] and Controller[1] with the button & axis index re-mapped.
b) The virtual controller button[0], button[1] and button[2] to are pre-assigned to commands Trigger
, Grab
, and Menu
correspondingly.
The detailed mapping of core commands, virtual controller index and button index are summarized in the below table.
Command | Input Type | Virtual Controller Index |
Virtual Controller Button Index |
Remark |
Trigger | Button Press | 0 | 0 | For first virtual controller |
TriggerUp | Button Up | 0 | 0 | |
TriggerHold | Button Hold | 0 | 0 | |
Grab | Button Press | 0 | 1 | |
Menu | Button Hold | 0 | 2 | |
Trigger=1 | Button Press | 1 | 0 | For second virtual controller |
Grab=1 | Button Press | 1 | 1 |
Here are few remarks about the setting the command and virtual controller event.
HTC VIVE / VIVE Pro Controller
HTC VIVE and VIVE Pro controller physical has four buttons, but the steam menu
button is reserved by SteamVR for calling its steam setting overlay. It has only three buttons can be used in the application. However, VotanicXR has reserved the Trigger
, Grab
and Menu
buttons for the core commands which is showed in the previous table.
Therefore, for HTC VIVE / VIVE Pro controllers, if the application is required to assign commands to the controller button, there are only two buttons can be used in the application.
- Button Up / Down / Press / Hold for
Trackpad
button - Button Up / Down for
Menu
button.
Assigning Input Device to Default Virtual Controller
The article Input Device Mapping for Virtual Controller highlighted that VotanicXR has native support for 5 common devices, namely Xbox controller, HTC VIVE (Pro), Valve Index, Oculus Rift, and Samsung Odyssey+, in which we have pre-mapped the button and axis of these devices to the default Virtual Controller. If you use one of these devices in your VotanicXR application, you can all features of VotanicXR right away, there is no more action required on the input button mapping.
However, if you use an input device that’s not yet supported in the common device list, and would like to use the default virtual controller (controller[0]), you must reassign the controller button index in the Trigger
, TriggerUp
, TriggerHold
, Grab
, and Menu
commands to desired button in the input device.
This situation also applies to the second virtual controller (controller[1]). The command Trigger=1
and Grab=1
are used for the second input device, and required to change the button index.
Assigning Input Device to Custom Virtual Controller
Another approach is to create a new virtual controller and custom the command triggering for the non-listed input device. In this case, please ensure the index of the new virtual controller is 2 or above (controller[2] or above), otherwise, the default button and axis mapping and binding will be used in the built-in commands. For details, you can check this article to create a virtual controller for other input devices.