Unigine.Plugins.AppOculus Class
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 |
---|---|
HMD = 0 | Oculus head-mounted display. |
CONTROLLER_LEFT = 1 | Left controller. |
CONTROLLER_RIGHT = 2 | Right controller. |
VIEWPORT#
Name | Description |
---|---|
BLACK_SCREEN = 0 | No image (black screen). |
MONO = 1 | Mono image. |
STEREO = 2 | Stereo image (left and right eye). |
STEREO_FINAL = 3 | Stereoscopic spherical image. |
Properties
float PositionScale#
The current world scale. when increasing the scale, the objects get smaller when they are farther away.
set
Sets a new scale for the world. When increasing the scale, the objects get smaller when they are farther away.
set value -
World scale.
AppOculus.VIEWPORT ViewportMode#
A value indicating the current viewport mode, that determines the type of image to be displayed in the viewport.
set
Sets the viewport mode, that determinss the type of image to be displayed in the viewport.
set value -
Viewport mode. One of the VIEWPORT variables.
bool IsEnabled#
The value indicating if the VR mode is enabled or not.
set
Toggles the VR mode.
set value -
true to enable the VR mode; false to disable it.
Members
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, ushort duration, float amplitude ) #
Sets the vibration of the given duration and amplitude.Arguments
- AppOculus.DEVICE device - Device ID, one of the DEVICE variables.
- ushort duration - Duration of the vibration.
- float amplitude - Amplitude of the vibration.
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.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.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)