This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
Professional (SIM)
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Materials and Shaders
Rebuilding the Engine 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
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Unigine.Plugins.Oculus Class

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

If the plugin is loaded together with the engine, the HAS_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_OCULUS
	// engine.oculus functions
#endif

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

See also#

Oculus Class

Enums

AXIS#

NameDescription
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.
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.
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.
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.
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.
THUMBSTICK_NO_DEADZONE = 5Horizontal and vertical thumbstick axis values, in the range -1.0f to 1.0f, without a deadzone.

TOUCH#

NameDescription
A = 1User is touching A button on the right controller.
B = 2User is touching B button on the right controller.
RTHUMB = 4User has a finger on the thumb stick of the right controller.
RTHUMB_REST = 8User has a finger on the textured thumb rest of the right controller.
RINDEX_TRIGGER = 16User is touching the index finger trigger on the right controller.
RINDEX_POINTING = 32User's right index finger is pointing forward past the trigger.
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.
X = 256User is touching X button on the left controller.
Y = 512User is touching Y button on the left controller.
LTHUMB = 1024User has a finger on the thumb stick of the left controller.
LTHUMB_REST = 2048User has a finger on the textured thumb rest of the left controller.
LINDEX_TRIGGER = 4096User is touching the index finger trigger on the left controller.
LINDEX_POINTING = 8192User's left index finger is pointing forward past the trigger.
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
A = 1A button on the right Touch controller.
B = 2B button on the right Touch controller.
RTHUMB = 4Thumb stick button on the right Touch controller.
RSHOULDER = 8Shoulder button on the right Touch controller.
X = 256X button on the left Touch controller.
Y = 512Y button on the left Touch controller.
LTHUMB = 1024Thumb stick button on the left Touch controller.
LSHOULDER = 2048Shoulder button on the left Touch controller.
UP = 65536The Up button on the remote controller.
DOWN = 131072The Down button on the remote controller.
LEFT = 262144The Left button on the remote controller.
RIGHT = 524288The Right button on the remote controller.
ENTER = 1048576Enter button on the left Touch controller. This is equivalent to the Start button on the Xbox controller.
BACK = 2097152The Back button on the remote controller.
VOLUP = 4194304The Volup button on the remote controller.
VOLDOWN = 8388608The Voldown button on the remote controller.
HOME = 16777216The Home button on the remote controller.

DEVICE#

NameDescription
HMD = 0Oculus head-mounted display.
CONTROLLER_LEFT = 1Left controller.
CONTROLLER_RIGHT = 2Right controller.

VIEWPORT#

NameDescription
BLACK_SCREEN = 0No image (black screen).
MONO = 1Mono image.
STEREO = 2Stereo image (left and right eye).
STEREO_FINAL = 3Stereoscopic spherical image.

Properties

float PositionScale#

The current world scale. when increasing the scale, the objects get smaller when they are farther away.

Oculus.VIEWPORT ViewportMode#

The A value indicating the current viewport mode, that determines the type of image to be displayed in the viewport.

bool Enabled#

The value indicating if the VR mode is enabled or not.

bool IsVisible#

The value indicating if the information about the HMD session status is visible.

uint TrackingStatus#

The current status of the sensor tracking.

quat LeveledTrackerRotation#

The current orientation (only sensor yaw, not roll and pitch) of the leveled sensor (aligned with gravity) relative to the tracking origin.

vec3 LeveledTrackerPosition#

The current position of the leveled sensor (aligned with gravity) relative to the tracking origin.

quat TrackerRotation#

The current orientation (sensor roll and pitch) of the sensor relative to the tracking origin.

vec3 TrackerPosition#

The current position of the sensor relative to the tracking origin.

vec3 HeadAngularAcceleration#

The current orientation of the head.

vec3 HeadLinearAcceleration#

The current linear acceleration of the head.

vec3 HeadAngularVelocity#

The current angular acceleration of the head.

vec3 HeadLinearVelocity#

The current linear acceleration of the head.

quat HeadRotation#

The Returns the current orientation of the head.

vec3 HeadPosition#

The current orientation of the head.

string HmdSerialNumber#

The serial number of the device.

int HmdHeight#

The vertical resolution of the full HMD screen (both eyes) in pixels.

int HmdWidth#

The horizontal resolution of the full HMD screen (both eyes) in pixels.

int AvailableTrackingCaps#

The Tracking capability bits that the system currently supports.

int AvailableHmdCaps#

The HMD capability bits that the device currently supports.

int DefaultTrackingCaps#

The Tracking capability bits that are default for the current system.

int DefaultHmdCaps#

The HMD capability bits that are default for the current device.

float HmdTrackerZFar#

The distance from the tracking sensor to the far Z clipping plane of viewing frustum.

float HmdTrackerZNear#

The distance from the tracking sensor to the near Z clipping plane of viewing frustum.

float HmdTrackerVFov#

The vertical FOV (if present) of the tracking sensor frustum in degrees.

float HmdTrackerHFov#

The horizontal FOV (if present) of the tracking sensor frustum in degrees.

int HmdFirmwareMinor#

The minor version of the device firmware.

int HmdFirmwareMajor#

The major version of the device firmware.

int HmdProductID#

The HID (USB) product identifier of the device.

int HmdVendorID#

The HID (USB) vendor identifier of the device.

string HmdManufacturer#

The name of the device manufacturer (UTF-8 encoded identification string).

string HmdProductName#

The name of the device (UTF-8 encoded product identification string).

int HmdType#

The type of the device.

string Version#

The libOVRRT version of the device.

bool HeadPositionLock#

The value indicating if the head position is locked.

bool HeadRotationLock#

The value indicating if the head rotation is locked.

Members


vec2 GetControllerAxis ( Oculus.DEVICE device, Oculus.AXIS axis ) #

Returns the coordinates of the specified controller axis along the X and Y axes.

Arguments

Return value

X and Y in the range of [-1;1] ([0;1] for a trigger).

bool GetControllerButtonPressed ( Oculus.BUTTON button ) #

Returns the value indicating if the specified button is pressed.

Arguments

Return value

true if the button is pressed; otherwise - false.

bool GetControllerButtonTouched ( Oculus.TOUCH button ) #

Returns the value indicating if the specified button is touched.

Arguments

Return value

true if the button is touched; otherwise - false.

void SetControllerVibration ( Oculus.DEVICE device, ushort duration, float amplitude ) #

Sets the vibration of the given duration and amplitude.

Arguments

  • Oculus.DEVICE device - Device ID, one of the DEVICE variables.
  • ushort duration - Duration of the vibration.
  • float amplitude - Amplitude of the vibration.

vec3 GetDeviceAngularVelocity ( Oculus.DEVICE device ) #

Returns a device angular velocity, in radians per second.

Arguments

Return value

Angular velocity.

bool IsDeviceConnected ( Oculus.DEVICE device ) #

Returns a value indicating if the device connected to the slot.

Arguments

Return value

true - connected; false - not connected.

mat4 GetDevicePose ( Oculus.DEVICE device ) #

Returns a single pose for a tracked device.

Arguments

Return value

Identity matrix.

vec3 GetDeviceVelocity ( Oculus.DEVICE device ) #

Returns a device velocity in tracker space, in meters per second.

Arguments

Return value

Velocity.

bool IsPoseValid ( Oculus.DEVICE device ) #

Returns a value indicating if the device pose is valid.

Arguments

Return value

true - valid; false - invalid.

vec4 GetHmdDefaultFov ( int num ) #

Returns the default optical field of view for the specified eye.

Arguments

  • int num - Eye: 0 for the left eye, 1 for the right eye.

Return value

Default field of view.

vec4 GetHmdMaxFov ( int num ) #

Returns the maximum optical field of view that can be practically rendered for the specified eye.

Arguments

  • int num - Eye: 0 for the left eye, 1 for the right eye.

Return value

Maximum field of view.

void ResetTracking ( ) #

Re-centers the sensor position and orientation: the (x,y,z) positional components and the yaw component of orientation. The roll and pitch components are always determined by gravity and cannot be redefined. See also ovr_RecenterTrackingOrigin method in the OVR_CAPI.h file reference.

vec4 GetEyeFov ( int num ) #

Returns the current field of view of the given eye.

Arguments

  • int num - Eye: 0 for the left eye, 1 for the right eye.

Return value

Eye field of view.

vec3 GetEyePosition ( int num ) #

Returns the current position of the given eye. The returned value was already multiplied by the current world scale.

Arguments

  • int num - Eye: 0 for the left eye, 1 for the right eye.

Return value

The eye position.

quat GetEyeRotation ( int num ) #

Returns the current orientation of the given eye.

Arguments

  • int num - Eye: 0 for the left eye, 1 for the right eye.

Return value

The eye orientation.

vec3 GetHandPosition ( int num ) #

Returns the current position of the given hand. The returned value was already multiplied by the current world scale.

Arguments

  • int num - Hand: 0 for the left hand, 1 for the right hand.

quat GetHandRotation ( int num ) #

Returns the current orientation of the given hand.

Arguments

  • int num - Hand: 0 for the left hand, 1 for the right hand.

void Render ( Player player, ivec2 size, bool render_window ) #

Arguments

Last update: 2023-08-08
Build: ()