UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
Extending Editor Functionality
FAQ
Программирование
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes

Unigine::Plugins::AppOculus Class

Header: #include <plugins/UnigineAppOculus.h>

This set of functions is available when the AppOculus plugin is loaded.

Notice
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:

Source code (UnigineScript)
#ifdef HAS_APP_OCULUS
	// engine.oculus functions
#endif

Notice
For more detailed information on application development with the Oculus Rift support, check also the following:

See also#

AppOculus Class

Enums

AXIS#

NameDescription
AXIS_INDEX_TRIGGER = 0Left and right finger trigger values, in the range 0.0 to 1.0f. A value of 1.0 means that the trigger is fully depressed.
AXIS_HAND_TRIGGER = 1Left and right hand trigger values, in the range 0.0 to 1.0f. Hand trigger is often used to grab items. A value of 1.0 means that the trigger is fully depressed.
AXIS_THUMBSTICK = 2Horizontal and vertical thumbstick axis values, in the range -1.0f to 1.0f. The API automatically applies the deadzone, so developers don’t need to handle it explicitly.
AXIS_INDEX_TRIGGER_NO_DEADZONE = 3Left and right finger trigger values, in the range 0.0 to 1.0f, without a deadzone. A value of 1.0 means that the trigger is fully depressed.
AXIS_HAND_TRIGGER_NO_DEADZONE = 4Left and right hand trigger values, in the range 0.0 to 1.0f, without a deadzone. Hand trigger is often used to grab items. A value of 1.0 means that the trigger is fully depressed.
AXIS_THUMBSTICK_NO_DEADZONE = 5Horizontal and vertical thumbstick axis values, in the range -1.0f to 1.0f, without a deadzone.

TOUCH#

NameDescription
TOUCH_A = 1User is touching A button on the right controller.
TOUCH_B = 2User is touching B button on the right controller.
TOUCH_RTHUMB = 4User has a finger on the thumb stick of the right controller.
TOUCH_RTHUMB_REST = 8User has a finger on the textured thumb rest of the right controller.
TOUCH_RINDEX_TRIGGER = 16User is touching the index finger trigger on the right controller.
TOUCH_RINDEX_POINTING = 32User's right index finger is pointing forward past the trigger.
TOUCH_RTHUMB_UP = 64User's right thumb is up and away from buttons on the controller, a gesture that can be interpreted as right thumbs up.
TOUCH_X = 256User is touching X button on the left controller.
TOUCH_Y = 512User is touching Y button on the left controller.
TOUCH_LTHUMB = 1024User has a finger on the thumb stick of the left controller.
TOUCH_LTHUMB_REST = 2048User has a finger on the textured thumb rest of the left controller.
TOUCH_LINDEX_TRIGGER = 4096User is touching the index finger trigger on the left controller.
TOUCH_LINDEX_POINTING = 8192User's left index finger is pointing forward past the trigger.
TOUCH_LTHUMB_UP = 16384User's left thumb is up and away from buttons on the controller, a gesture that can be interpreted as left thumbs up.

BUTTON#

NameDescription
BUTTON_A = 1A button on the right Touch controller.
BUTTON_B = 2B button on the right Touch controller.
BUTTON_RTHUMB = 4Thumb stick button on the right Touch controller.
BUTTON_RSHOULDER = 8Shoulder button on the right Touch controller.
BUTTON_X = 256X button on the left Touch controller.
BUTTON_Y = 512Y button on the left Touch controller.
BUTTON_LTHUMB = 1024Thumb stick button on the left Touch controller.
BUTTON_LSHOULDER = 2048Shoulder button on the left Touch controller.
BUTTON_UP = 65536The Up button on the remote controller.
BUTTON_DOWN = 131072The Down button on the remote controller.
BUTTON_LEFT = 262144The Left button on the remote controller.
BUTTON_RIGHT = 524288The Right button on the remote controller.
BUTTON_ENTER = 1048576Enter button on the left Touch controller. This is equivalent to the Start button on the Xbox controller.
BUTTON_BACK = 2097152The Back button on the remote controller.
BUTTON_VOLUP = 4194304The Volup button on the remote controller.
BUTTON_VOLDOWN = 8388608The Voldown button on the remote controller.
BUTTON_HOME = 16777216The Home button on the remote controller.

DEVICE#

NameDescription
DEVICE_HMD = 0Oculus head-mounted display.
DEVICE_CONTROLLER_LEFT = 1Left controller.
DEVICE_CONTROLLER_RIGHT = 2Right controller.

VIEWPORT#

NameDescription
VIEWPORT_BLACK_SCREEN = 0No image (black screen).
VIEWPORT_MONO = 1Mono image.
VIEWPORT_STEREO = 2Stereo image (left and right eye).
VIEWPORT_STEREO_FINAL = 3Stereoscopic 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: 21.01.2020