Unigine::Plugins::AppOculus Class
Header: | #include <plugins/UnigineAppOculus.h> |
This set of functions is available when the AppOculus plugin is loaded.
AppOculus plugin cannot be used in a Qt-based application
If the plugin is loaded together with the engine, the HAS_APP_OCULUS definition is set. This definition can be used, for example, to avoid errors if the plugin is not loaded: the code in which the plugin functions are executed can be wrapped around as follows:
#ifdef HAS_APP_OCULUS
// engine.oculus functions
#endif
For more detailed information on application development with the Oculus Rift support, check also the following:
- openvr File Reference
- The Oculus Best Practices document and the Oculus Developer Guide document that can be downloaded from the official web site.
See also#
A UnigineScript API sample <UnigineSDK>/data/samples/plugins/app_oculus_00
AppOculus Class
Enums
AXIS#
TOUCH#
BUTTON#
DEVICE#
Name | Description |
---|---|
DEVICE_HMD = 0 | Oculus head-mounted display. |
DEVICE_CONTROLLER_LEFT = 1 | Left controller. |
DEVICE_CONTROLLER_RIGHT = 2 | Right controller. |
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). |
VIEWPORT_STEREO_FINAL = 3 | Stereoscopic spherical image. |
Members
Math::vec2 getControllerAxis ( AppOculus::DEVICE device, AppOculus::AXIS axis ) #
Returns the coordinates of the specified controller axis along the X and Y axes.Arguments
- AppOculus::DEVICE device - Device ID, one of the DEVICE variables.
- AppOculus::AXIS axis - One of the AXIS variables.
Return value
X and Y in the range of [-1;1] ([0;1] for a trigger).bool getControllerButtonPressed ( AppOculus::DEVICE device, AppOculus::BUTTON button ) #
Returns the value indicating if the specified button is pressed.Arguments
- AppOculus::DEVICE device - Device ID, one of the DEVICE variables.
- AppOculus::BUTTON button - A button, one of the BUTTON variables.
Return value
true if the button is pressed; otherwise - false.bool getControllerButtonTouched ( AppOculus::DEVICE device, AppOculus::BUTTON button ) #
Returns the value indicating if the specified button is touched.Arguments
- AppOculus::DEVICE device - Device ID, one of the DEVICE variables.
- AppOculus::BUTTON button - A button, one of the TOUCH variables.
Return value
true if the button is touched; otherwise - false.void setControllerVibration ( AppOculus::DEVICE device, unsigned short duration, float amplitude ) #
Sets the vibration of the given duration and amplitude.Arguments
- AppOculus::DEVICE device - Device ID, one of the DEVICE variables.
- unsigned short duration - Duration of the vibration.
- float amplitude - Amplitude of the vibration.
Math::vec3 getDeviceAngularVelocity ( AppOculus::DEVICE device ) #
Returns a device angular velocity, in radians per second.Arguments
- AppOculus::DEVICE device - Device ID, one of the DEVICE variables.
Return value
Angular velocity.bool isDeviceConnected ( AppOculus::DEVICE device ) #
Returns a value indicating if the device connected to the slot.Arguments
- AppOculus::DEVICE device - Device ID, one of the DEVICE variables.
Return value
true - connected; false - not connected.Math::mat4 getDevicePose ( AppOculus::DEVICE device ) #
Returns a single pose for a tracked device.Arguments
- AppOculus::DEVICE device - Device ID, one of the DEVICE variables.
Return value
Identity matrix.Math::vec3 getDeviceVelocity ( AppOculus::DEVICE device ) #
Returns a device velocity in tracker space, in meters per second.Arguments
- AppOculus::DEVICE device - Device ID, one of the DEVICE variables.
Return value
Velocity.void setEnabled ( bool enabled ) #
Toggles the VR mode.Arguments
- bool enabled - true to enable the VR mode; false to disable it.
bool isEnabled ( ) #
Returns the value indicating if the VR mode is enabled or not.Return value
true if the VR mode is enabled; false if it is disabled.void setHeadPositionLock ( bool lock ) #
Locks the head position.Arguments
- bool lock - true to lock the head position.
bool isHeadPositionLocked ( ) #
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 isHeadRotationLocked ( ) #
Returns the value indicating if the head rotation is locked.Return value
true if the head rotation is locked; otherwise - false.bool isPoseValid ( AppOculus::DEVICE device ) #
Returns a value indicating if the device pose is valid.Arguments
- AppOculus::DEVICE device - Device ID, one of the DEVICE variables.
Return value
true - valid; false - invalid.void setPositionScale ( float scale ) #
Sets a new scale for the world. When increasing the scale, the objects get smaller when they are farther away.Arguments
- float scale - World scale.
float getPositionScale ( ) #
Returns the current world scale. When increasing the scale, the objects get smaller when they are farther away.Return value
World scale.AppOculus::VIEWPORT getViewportMode ( ) #
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 ( AppOculus::VIEWPORT mode ) #
Sets the viewport mode, that determinss the type of image to be displayed in the viewport.Arguments
- AppOculus::VIEWPORT mode - Viewport mode. One of the VIEWPORT variables.
Last update:
2020-04-10
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)