This page has been translated automatically.
Programming
Fundamentals
Setting Up Development Environment
UnigineScript
High-Level Systems
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
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Rendering-Related Classes
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

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

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:

int OCULUS_HMD_DK1

Description

The type of the HMD is Oculus Rift DK1. It corresponds to the value of 3. See also OVR_CAPI.h file reference.

int OCULUS_HMD_DK2

Description

The type of the HMD is Oculus Rift DK2. It corresponds to the value of 6. See also OVR_CAPI.h file reference.

int OCULUS_HMD_DKDH

Description

The type of the HMD is Oculus Rift HD prototype. It corresponds to the value of 4. See also OVR_CAPI.h file reference.

int OCULUS_HMD_CB

Description

The type of the HMD is Crescent Bay prototype (Oculus Rift CV1). It corresponds to the value of 8. See also OVR_CAPI.h file reference.

int OCULUS_STATUS_POSITION_TRACKED

Description

A bit flag indicating that the sensor position is currently tracked (false if out of range). See also OVR_CAPI.h file reference.

int OCULUS_STATUS_ROTATION_TRACKED

Description

A bit flag indicating that the sensor orientation is currently tracked (connected and in use). See also OVR_CAPI.h file reference.

int OCULUS_TRACKING_CAP_MAG_YAW_CORRECTION

Description

A bit flag indicating that yaw drift correction via a magnetometer or other means is supported. See also OVR_CAPI.h file reference.

int OCULUS_TRACKING_CAP_POSITION

Description

A bit flag indicating that positional tracking is supported. See also OVR_CAPI.h file reference.

int OCULUS_TRACKING_CAP_ROTATION

Description

A bit flag indicating that orientation tracking is supported. See also OVR_CAPI.h file reference.

void engine.oculus.setEnabled(int enabled)

Toggles the VR mode.

Arguments

  • int enabled - 1 to enable the VR mode; 0 to disable it.

int engine.oculus.isEnabled()

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

Return value

1 if the VR mode is enabled; 0 if it is disabled.

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.getHmdType()

Returns the type of the HMD: OCULUS_HMD_DK1,OCULUS_HMD_DKHD,OCULUS_HMD_DK2orOCULUS_HMD_CB.

Return value

The HMD type.

string engine.oculus.getHmdProductName()

Returns the name of the device (UTF-8 encoded product identification string). For example: "Oculus Rift DK1".

Return value

The device name.

string engine.oculus.getHmdManufacturer()

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

Return value

The manufacturer name.

int engine.oculus.getHmdVendorID()

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

Return value

Vendor ID.

int engine.oculus.getHmdProductID()

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

Return value

HID product identifier.

string engine.oculus.getHmdSerialNumber()

Returns the serial number of the HMD.

Return value

HMD serial number.

int engine.oculus.getHmdFirmwareMajor()

Returns the major version of the HMD firmware.

Return value

The major version of the HMD firmware.

int engine.oculus.getHmdFirmwareMinor()

Returns the minor version of the HMD firmware.

Return value

The minor version of the HMD firmware.

int engine.oculus.getAvailableHmdCaps()

Returns HMD capability bits that the HMD currently supports.

Return value

HMD capability bits.

int engine.oculus.getDefaultHmdCaps()

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

Return value

Default HMD capability bits.

int engine.oculus.getAvailableTrackingCaps()

Returns tracking capability bits that the system currently supports.

Return value

Tracking capability bits.

int engine.oculus.getDefaultTrackingCaps()

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

Return value

Default tracking capability bits.

vec4 engine.oculus.getHmdDefaultFov(int num)

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

Arguments

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

Return value

Recommended 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.getHmdHeight()

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

Return value

Vertical resolution in pixels.

int engine.oculus.getHmdWidth()

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

Return value

Horizontal resolution in pixels.

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.getHmdTrackerZFar()

Returns the distance from the tracking sensor to the tracking frustum far Z. 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.

float engine.oculus.getHmdTrackerZNear()

Returns the distance from the tracking sensor to the tracking frustum near Z. 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.

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.getHeadAngularAcceleration()

Returns the current angular acceleration of the head.

Return value

Angular acceleration of the head in radians per second squared.

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.getHeadLinearVelocity()

Returns the current linear velocity of the head.

Return value

Linear velocity of the head in meters per second.

int engine.oculus.getTrackingStatus()

Returns the current status of the sensor tracking (OCULUS_STATUS_*variables).

Return value

Status of the sensor tracking (OCULUS_STATUS_*variables).

vec3 engine.oculus.getTrackerPosition()

Returns the 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 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 position of the leveled sensor (aligned with gravity) relative to the tracking origin.

Return value

Position of the leveled sensor relative to the tracking origin.

quat engine.oculus.getLeveledTrackerRotation()

Returns 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.

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 process is visible in the HMD; otherwise, 0.

string engine.oculus.getVersion()

Returns the libOVRRT version.

Return value

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

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.
Last update: 2017-07-03
Build: ()