engine.oculus Functions
UnigineScript is deprecated and will be removed in future releases. Please consider using C#/C++ instead, as these APIs are the preferred ones. Availability of new Engine features in UnigineScipt is not guaranteed, as the current level of support assumes only fixing critical issues.
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
Members
vec2 engine.oculus.getControllerAxis ( int device, int axis ) #
Returns the coordinates of the specified controller axis along the X and Y axes.Arguments
- int device - Device ID, one of the APP_OCULUS_DEVICE_ variables.
- int axis - One of the APP_OCULUS_AXIS_ variables.
Return value
X and Y in the range of [-1;1] ([0;1] for a trigger).bool engine.oculus.getControllerButtonPressed ( int device, int button ) #
Returns the value indicating if the specified button is pressed.Arguments
- int device - Device ID, one of the APP_OCULUS_DEVICE_ variables.
- int button - A button, one of the APP_OCULUS_BUTTON_ variables.
Return value
true if the button is pressed; otherwise - false.bool engine.oculus.getControllerButtonTouched ( int device, int button ) #
Returns the value indicating if the specified button is touched.Arguments
- int device - Device ID, one of the APP_OCULUS_DEVICE_ variables.
- int button - A button, one of the APP_OCULUS_TOUCH_ variables.
Return value
true if the button is touched; otherwise - false.void engine.oculus.setControllerVibration ( int device, int duration, float amplitude ) #
Sets the vibration of the given duration and amplitude.Arguments
- int device - Device ID, one of the APP_OCULUS_DEVICE_ variables.
- int duration - Duration of the vibration.
- float amplitude - Amplitude of the vibration.
vec3 engine.oculus.getDeviceAngularVelocity ( int device ) #
Returns a device angular velocity, in radians per second.Arguments
- int device - Device ID, one of the APP_OCULUS_DEVICE_ variables.
Return value
Angular velocity.bool engine.oculus.isDeviceConnected ( int device ) #
Returns a value indicating if the device connected to the slot.Arguments
- int device - Device ID, one of the APP_OCULUS_DEVICE_ variables.
Return value
true - connected; false - not connected.mat4 engine.oculus.getDevicePose ( int device ) #
Returns a single pose for a tracked device.Arguments
- int device - Device ID, one of the APP_OCULUS_DEVICE_ variables.
Return value
Identity matrix.vec3 engine.oculus.getDeviceVelocity ( int device ) #
Returns a device velocity in tracker space, in meters per second.Arguments
- int device - Device ID, one of the APP_OCULUS_DEVICE_ variables.
Return value
Velocity.void engine.oculus.setEnabled ( bool enabled ) #
Toggles the VR mode.Arguments
- bool enabled - true to enable the VR mode; false to disable it.
bool engine.oculus.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 engine.oculus.setHeadPositionLock ( bool lock ) #
Locks the head position.Arguments
- bool lock - true to lock the head position.
bool engine.oculus.isHeadPositionLocked ( ) #
Returns the value indicating if the head position is locked.Return value
true if the head position is locked; otherwise - false.void engine.oculus.setHeadRotationLock ( bool lock ) #
Locks the head rotation.Arguments
- bool lock - true to lock the head rotation.
bool engine.oculus.isHeadRotationLocked ( ) #
Returns the value indicating if the head rotation is locked.Return value
true if the head rotation is locked; otherwise - false.bool engine.oculus.isPoseValid ( int device ) #
Returns a value indicating if the device pose is valid.Arguments
- int device - Device ID, one of the APP_OCULUS_DEVICE_ variables.
Return value
true - valid; false - invalid.void engine.oculus.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 engine.oculus.getPositionScale ( ) #
Returns the current world scale. When increasing the scale, the objects get smaller when they are farther away.Return value
World scale.int engine.oculus.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 APP_OCULUS_VIEWPORT_ variables.void engine.oculus.setViewportMode ( int mode ) #
Sets the viewport mode, that determinss the type of image to be displayed in the viewport.Arguments
- int mode - Viewport mode. One of the APP_OCULUS_VIEWPORT_ variables.
Last update:
2020-04-10
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)