OpenVRSensor
- Last UpdatedFeb 19, 2025
- 4 minute read
An OpenVRSensor node can be used only when running an app targeting an OpenVR rendering pipeline. For more information, see Graphics.renderSetupFilePath.
-
This is a singleton node. Only one instance of it can exist in an application.
-
The templates supporting OpenVR target already contain a definition for the node, so you can patch it in projects or change values at runtime.
-
The OpenVRSensor node contains all the parameters required to handle the OpenVR events and tracking matrices. The parameters relative to OpenVR controllers start with controller0\ for left controller and controller1\ for right controller.
Platform support
This node is supported on XR-Windows platform only.
|
XR-WIN |
XR-P-WIN |
XR-P-IOS |
XR-P-AND |
XR-P-WASM |
|---|---|---|---|---|
|
Full support |
No support |
No support |
No support |
No support |
|
|
|
|
|
|
Code example
This is a code example for the OpenVRSensor node.
<patch name="openvr" controller0\pulse="0.1 0.5 1" controller0\vibrationPulse="0.5" controller0\vibrationStrength="1" controller0\vibrationTime="0.1" />
OpenVRSensor fields
These are the fields for OpenVRSensor node. Only the node-specific fields are indicated, not fields obtained by inheritance.
Field inheritance: NodeBase > OpenVRSensor
|
Field |
Type |
Use |
Default |
Description |
|---|---|---|---|---|
|
active |
sbool |
Optional |
true |
Controller fields
These are the fields relative to OpenVR devices that start with hmd\ for the headset, controller0\ for left controller and controller1\ for right controller.
|
Fields |
Type |
Use |
Default |
Description |
|---|---|---|---|---|
|
APressed/ATouched |
sbool |
Read only |
Only for controller1\ It is set to True when the button is pressed/touched and to False when it is released. |
|
|
BPressed/BTouched |
sbool |
Read only |
Only for controller1\ It is set to True when the button is pressed/touched and to False when it is released. |
|
|
CPressed/CTouched |
sbool |
Read only |
|
Only for controller0\ It is set to True when the button is pressed/touched and to False when it is released. |
|
DPressed/DTouched |
sbool |
Read only |
|
Only for controller0\ It is set to True when the button is pressed/touched and to False when it is released. |
|
UPPressed/UPTouched |
sbool |
Read only |
|
Only for controller0\ and for controller1\ It is set to True when the button is pressed/touched and to False when it is released. |
|
DownPressed/DownTouched |
sbool |
Read only |
|
Only for controller0\ and for controller1\ It is set to True when the button is pressed/touched and to False when it is released. |
|
LeftPressed/LeftTouched |
sbool |
Read only |
|
Only for controller0\ and for controller1\ It is set to True when the button is pressed/touched and to False when it is released. |
|
RightPressed/RightTouched |
sbool |
Read only |
|
Only for controller0\ and for controller1\ It is set to True when the button is pressed/touched and to False when it is released. |
|
gripButtonPressed |
sbool |
Read only |
It is set to True when the grip is pressed/touched and to False when it is released. |
|
|
localMatrix |
smatrix |
Read only |
Constantly updated based on the tracking values with the matrix value of the local space of the controller. |
|
|
localOrientation |
svec3 |
Read only |
Constantly updated based on the tracking values with the orientation of the controller in radiant yaw, pitch and roll. |
|
|
localPosition |
svec3 |
Read only |
Constantly updated based on the tracking values with the position value of the local space of the controller. |
|
|
menuButtonPressed |
sbool |
Read only |
Only for controllerL\ It is set to True when the menu button is pressed and to False when it is released. |
|
|
model |
sstring |
Read only |
Depends on configuration |
Models to show where the hands are. The model shown can be configured from cfg_commons.xml under vr.handLeftModel and vr.handRightModel. Available options are:
|
|
pulse |
svec3 |
Optional |
When set it makes the controller vibrate using the three given values as vibrationTime, vibrationPulse, and vibrationStrength. |
|
|
touchpadAxis |
svec2 |
Read only |
|
Analogical axis values of the controller thumbstick position in normalized axis (from -1 to 1 on horizontal left to right and vertical bottom to up) |
|
triggerAxis |
svec2 |
Read only |
Analogical axis values of the controller thumbstick position in normalized axis (from -1 to 1 on horizontal left to right and vertical bottom to up) |
|
|
touchpadButtonPressed/ touchpadButtonTouched |
sbool |
Read only |
It is set to True when the thumbstick is pressed/touched and to False when it is released. |
|
|
triggerButtonPressed/ triggerButtonTouched |
sbool |
Read only |
It is set to True when the trigger is pressed/touched and to False when it is released. |
|
|
vibrate |
sevent |
When triggered it makes the controller vibrate using the vibrationPulse, vibrationStrength and vibrationTime defined in the corresponding fields. |
||
|
vibrationPulse |
sfloat |
Optional |
0.001 |
Used as a parameter for the vibrate event. |
|
vibrationStrength |
sfloat |
Optional |
0.5 |
Used as a parameter for the vibrate event. It defines the strength of the vibration. |
|
vibrationTime |
sfloat |
Optional |
1 |
Used as a parameter for the vibrate event. It defines the time length in seconds of the vibration. |
|
worldMatrix |
smatrix |
Read only |
Constantly updated based on the tracking values with the matrix value of the world space. |
|
|
worldOrientation |
svec3 |
Read only |
Constantly updated based on the tracking values with the orientation of the world in radiant yaw, pitch and roll. |
|
|
worldPosition |
svec3 |
Read only |
Constantly updated based on the tracking values with the position value of the world of the controller. |