This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Landscape Tool
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
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.

engine.oculus Functions

Warning
The scope of applications for UnigineScript is limited to implementing materials-related logic (material expressions, scriptable materials, brush materials). Do not use UnigineScript as a language for application logic, please consider C#/C++ instead, as these APIs are the preferred ones. Availability of new Engine features in UnigineScript (beyond its scope of applications) 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.

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

Members


vec2 engine.oculus.getControllerAxis ( int device, int 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 engine.oculus.getControllerButtonPressed ( int button ) #

Returns the value indicating if the specified button is pressed.

Arguments

Return value

true if the button is pressed; otherwise - false.

bool engine.oculus.getControllerButtonTouched ( int button ) #

Returns the value indicating if the specified button is touched.

Arguments

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

Return value

Angular velocity.

bool engine.oculus.isDeviceConnected ( int device ) #

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

Arguments

Return value

true - connected; false - not connected.

mat4 engine.oculus.getDevicePose ( int device ) #

Returns a single pose for a tracked device.

Arguments

Return value

Identity matrix.

vec3 engine.oculus.getDeviceVelocity ( int device ) #

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

Arguments

Return value

Velocity.

void engine.oculus.setEnabled ( int enabled ) #

Toggles the VR mode.

Arguments

  • int enabled - true to enable the VR mode; false to disable it.

int 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

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 world scales the type of image to be displayed in the viewport.

Arguments

string engine.oculus.getVersion ( ) #

Returns the libOVRT version of the HMD.

Return value

The libOVR version (a UTF-8 encoded null-terminated version string).

int engine.oculus.getHmdType ( ) #

Returns the OpenVR type of the HMD.

Return value

HMD type.

string engine.oculus.getHmdProductName ( ) #

Returns the name of the HMD (UTF-8 encoded product identification string).

Return value

Device name.

string engine.oculus.getHmdManufacturer ( ) #

Returns the name of the HMD manufacturer (UTF-8 encoded identification string).

Return value

Manufacturer name.

int engine.oculus.getHmdVendorID ( ) #

Returns the HID (USB) vendor identifier of the HMD.

Return value

Vendor ID.

int engine.oculus.getHmdProductID ( ) #

Returns the HID (USB) product identifier of the HMD.

Return value

HID product identifier.

int engine.oculus.getHmdFirmwareMajor ( ) #

Returns the major version of the HMD firmware.

Return value

Major version of the device firmware.

int engine.oculus.getHmdFirmwareMinor ( ) #

Returns the minor version of the HMD firmware.

Return value

Minor version of the device firmware.

float engine.oculus.getHmdTrackerHFov ( ) #

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

Return value

Horizontal FOV of the tracking sensor frustum in degrees.

float engine.oculus.getHmdTrackerVFov ( ) #

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

Return value

Vertical FOV of the tracking sensor frustum in degrees.

float engine.oculus.getHmdTrackerZNear ( ) #

Returns the distance from the tracking sensor to the near Z clipping plane of viewing frustum.. The returned value was already multiplied by the current world scale.

Return value

Distance from the tracking sensor to the tracking frustum near Z in meters.

float engine.oculus.getHmdTrackerZFar ( ) #

Returns the distance from the tracking sensor to the far Z clipping plane of viewing frustum.. The returned value was already multiplied by the current world scale.

Return value

Distance from the tracking sensor to the tracking frustum far Z in meters.

int engine.oculus.getDefaultHmdCaps ( ) #

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

Return value

Default HMD capability bits.

int engine.oculus.getDefaultTrackingCaps ( ) #

Returns tracking capability bits that are default for the current system.

Return value

Default tracking capability bits.

int engine.oculus.getAvailableHmdCaps ( ) #

Returns HMD capability bits that the device currently supports.

Return value

HMD capability bits.

int engine.oculus.getAvailableTrackingCaps ( ) #

Returns tracking capability bits that the system currently supports.

Return value

Tracking capability bits.

vec4 engine.oculus.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 engine.oculus.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.

int engine.oculus.getHmdWidth ( ) #

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

Return value

Horizontal resolution in pixels.

int engine.oculus.getHmdHeight ( ) #

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

Return value

Vertical resolution in pixels.

string engine.oculus.getHmdSerialNumber ( ) #

Returns the serial number of the HMD.

Return value

HMD Serial number.

void engine.oculus.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 engine.oculus.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 engine.oculus.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 engine.oculus.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 engine.oculus.getHeadPosition ( ) #

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

Return value

Position of the head.

quat engine.oculus.getHeadRotation ( ) #

Returns the current orientation of the head.

Return value

Orientation of the head.

vec3 engine.oculus.getHeadLinearVelocity ( ) #

Returns the current linear velocity of the head.

Return value

Linear velocity of the head in meters per second.

vec3 engine.oculus.getHeadAngularVelocity ( ) #

Returns the current angular velocity of the head.

Return value

Angular velocity of the head in radians per second.

vec3 engine.oculus.getHeadLinearAcceleration ( ) #

Returns the current linear acceleration of the head.

Return value

Linear acceleration of the head in meters per second squared.

vec3 engine.oculus.getHeadAngularAcceleration ( ) #

Returns the current angular acceleration of the head.

Return value

Angular acceleration of the head in radians per second squared.

vec3 engine.oculus.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 engine.oculus.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.

vec3 engine.oculus.getTrackerPosition ( ) #

Returns the current position of the sensor relative to the tracking origin. The returned value was already multiplied by the current world scale.

Return value

Position of the sensor relative to the tracking origin.

quat engine.oculus.getTrackerRotation ( ) #

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

Return value

Orientation (roll and pitch) of the sensor relative to the tracking origin.

vec3 engine.oculus.getLeveledTrackerPosition ( ) #

Returns the current position of the leveled sensor (aligned with gravity) relative to the tracking origin. The returned value was already multiplied by the current world scale.

Return value

Position of the leveled sensor relative to the tracking origin.

quat engine.oculus.getLeveledTrackerRotation ( ) #

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

Return value

Orientation (yaw) of the sensor relative to the tracking origin.

unsigned int engine.oculus.getTrackingStatus ( ) #

Returns the current status of the sensor tracking.

Return value

Status of the sensor tracking.

int engine.oculus.isVisible ( ) #

Returns a value indicating if the process has VR focus and thus is visible in HMD.

Return value

1 if the information about the HMD session status is visible; otherwise, 0.
Last update: 2021-12-13
Build: ()