Unigine::Plugins::OpenVR Class
Header: | #include <plugins/Unigine/OpenVR/UnigineOpenVR.h> |
OpenVR Class
Enums
CONTROLLER_ROLE#
BUTTON#
Name | Description |
---|---|
BUTTON_SYSTEM = 0 | The system button. These events are not visible to applications and are used internally to bring up the Steam Overlay or the Steam Client. |
BUTTON_APPLICATIONMENU = 1 | The application menu button. |
BUTTON_GRIP = 2 | The grip button. |
BUTTON_DPAD_LEFT = 3 | The sensor panel left button. |
BUTTON_DPAD_UP = 4 | The sensor panel up button. |
BUTTON_DPAD_RIGHT = 5 | The sensor panel right button. |
BUTTON_DPAD_DOWN = 6 | The sensor panel down button. |
BUTTON_A = 7 | The button reserved for manual controllers. |
BUTTON_AXIS0 = 32 | The axis reserved for manual controllers. |
BUTTON_AXIS1 = 33 | The axis reserved for manual controllers. |
BUTTON_AXIS2 = 34 | The axis reserved for manual controllers. |
BUTTON_AXIS3 = 35 | The axis reserved for manual controllers. |
BUTTON_AXIS4 = 36 | The axis reserved for manual controllers. |
BUTTON_STEAMVR_TOUCHPAD = 32 | The touchpad on the SteamVR controller. It is the same as BUTTON_AXIS0. |
BUTTON_STEAMVR_TRIGGER = 33 | The trigger on the SteamVR controller. It is the same as BUTTON_AXIS1. |
BUTTON_DASHBOARD_BACK = 2 | The back to dashboard button. |
BUTTON_MAX = 64 | This is not an actual button. It just indicates the maximum number of buttons in the system. |
AXIS#
Name | Description |
---|---|
AXIS_NONE = 0 | No axis is identified on the controller. |
AXIS_TRACKPAD = 1 | An axis of a trackpad type. |
AXIS_JOYSTICK = 2 | An axis of a joystick type. |
AXIS_TRIGGER = 3 | An axis of a trigger type. |
DEVICE#
VIEWPORT#
Name | Description |
---|---|
VIEWPORT_BLACK_SCREEN = 0 | No image (black screen). |
VIEWPORT_MONO = 1 | Mono image. |
VIEWPORT_STEREO = 2 | Stereo image (left and right eye). |
TRACKING_SPACE#
Members
Math::vec2 getControllerAxis ( int device_num, int axis_num ) #
Returns the coordinates of the specified controller axis along the X and Y axes.Arguments
- int device_num - Device ID.
- int axis_num - Axis number.
Return value
X and Y in the range of [-1;1] ([0;1] for a trigger).bool getControllerButtonPressed ( int device_num, OpenVR::BUTTON button ) #
Returns the value indicating if the specified button is pressed.Arguments
- int device_num - Device ID.
- OpenVR::BUTTON button - A button, one of the BUTTON variables.
Return value
true if the button is pressed; otherwise - false.bool getControllerButtonTouched ( int device_num, OpenVR::BUTTON button ) #
Returns the value indicating if the specified button is touched.Arguments
- int device_num - Device ID.
- OpenVR::BUTTON button - A button, one of the BUTTON variables.
Return value
true if the button is pressed; otherwise - false.int getControllerPacketNum ( int device_num ) #
Returns the number of the controller packet.Arguments
- int device_num - Device ID.
Return value
Number of the controller packet.void setControllerVibration ( int device_num, unsigned short duration ) #
Sets the vibration of the given duration and amplitude.Arguments
- int device_num - Device ID.
- unsigned short duration - Duration of the vibration.
Math::vec3 getDeviceAngularVelocity ( int device_num ) #
Returns a device angular velocity, in radians per second.Arguments
- int device_num - Device ID.
Return value
Angular velocity.bool isDeviceConnected ( int device_num ) #
Returns a value indicating if the device connected to the slot.Arguments
- int device_num - Device ID.
Return value
true - connected; false - not connected.Math::mat4 getDeviceTransform ( int device_num ) #
Returns a single pose for a tracked device.Arguments
- int device_num - Device ID.
Return value
Identity matrix.OpenVR::DEVICE getDeviceType ( int device_num ) #
Returns the device type.Arguments
- int device_num - Device ID.
Return value
Device type, one of the DEVICE variables.Math::vec3 getDeviceVelocity ( int device_num ) #
Returns a device velocity in tracker space, in meters per second.Arguments
- int device_num - Device ID.
Return value
Velocity.void setHeadPositionLock ( bool lock ) #
Locks the head position.Arguments
- bool lock - true to lock the head position.
bool isHeadPositionLock ( ) const#
Returns the value indicating if the head position is locked.Return value
true if the head position is locked; otherwise - false.void setHeadRotationLock ( bool lock ) #
Locks the head rotation.Arguments
- bool lock - true to lock the head rotation.
bool isHeadRotationLock ( ) const#
Returns the value indicating if the head rotation is locked.Return value
true if the head rotation is locked; otherwise - false.bool isPoseValid ( int device_num ) #
Returns a value indicating if the device pose is valid.Arguments
- int device_num - Device ID.
Return value
true - valid; false - invalid.int getTrackingResult ( int device_num ) #
Returns the value indicating the tracking result:- Uninitialized
- Calibrating in progress
- Calibrating out of range
- Running correctly
- Running out of range
Arguments
- int device_num - Device ID.
Return value
Tracking result.OpenVR::VIEWPORT getViewportMode ( ) const#
Returns a value indicating the current viewport mode, that determines the type of image to be displayed in the viewport.Return value
Current viewport mode. One of the VIEWPORT variables.void setViewportMode ( OpenVR::VIEWPORT mode ) #
Sets the viewport mode, that determines the type of image to be displayed in the viewport.Arguments
- OpenVR::VIEWPORT mode - Viewport mode. One of the VIEWPORT variables.
int getMaxTrackedDeviceCount ( ) const#
Returns the maximum value of tracked devices.Return value
The maximum value of tracked devices.int getControllerStateAxisCount ( ) const#
Returns a number of axes.Return value
Number of axes.OpenVR::AXIS getDeviceAxisType ( int device_num, int axis_num ) #
Returns the value that identifies what type of axis is on the indicated controller.Arguments
- int device_num - Device ID.
- int axis_num - Axis number.
Return value
Axis of a corresponding type. One of the AXIS variables.String getDeviceManufacturerName ( int device ) #
Returns the manufacturer name of the specified device.Arguments
- int device - Device ID.
Return value
Manufacturer name.String getDeviceModelNumber ( int device ) #
Returns the model of the specified device.Arguments
- int device - Device ID.
Return value
Model.OpenVR::CONTROLLER_ROLE getControllerRole ( int device_num ) #
Returns a specific role associated with a tracked device.Arguments
- int device_num - Device ID.
Return value
Role associated with a tracked device. One of the CONTROLLER_ROLE variables.void render ( const Ptr<Player> & player, const Math::ivec2 & size, bool render_window ) #
Calls OpenVR rendering logic.Arguments
- const Ptr<Player> & player - The player camera.
- const Math::ivec2 & size - The window size, in pixels.
- bool render_window - true to enable rendering of a copy to the current render target window; false — to disable it.
void fadeToColor ( float time, const Math::vec4 & color, bool background = false ) #
Fades the view on the head-mounted display to the specified color.Arguments
- float time - Time in seconds that the fade will take.
- const Math::vec4 & color - Fade color.
- bool background -
Math::vec4 getCurrentFadeColor ( bool background = false ) #
Returns the current fade color.Arguments
- bool background -
Return value
Fade color.void fadeToGrid ( float time, bool grid ) #
Fades the grid in or out.Arguments
- float time - Time in seconds that the fade will take.
- bool grid - true to fade the grid in, false to fade the grid out.
float getCurrentGridAlpha ( ) #
Returns the current alpha value of the grid.Return value
Grid alpha value.void setTrackingSpace ( OpenVR::TRACKING_SPACE space ) #
Sets a zero pose for the tracking origin.Arguments
- OpenVR::TRACKING_SPACE space - Zero pose of the tracking origin.
OpenVR::TRACKING_SPACE getTrackingSpace ( ) const#
Returns the current zero pose of the tracking origin.Return value
Zero pose of the tracking origin.void resetZeroPose ( OpenVR::TRACKING_SPACE space ) #
Sets the zero pose of the given tracker coordinate system to the current tracker position.Arguments
- OpenVR::TRACKING_SPACE space - Tracker coordinate system.
Last update:
2024-06-10
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)