GearVR - stingray.GearVR namespace reference - Stingray Lua API Reference

stingray.GearVR namespace reference

Description

This object provides access to the GearVR interface.

Functions

Parameters
This function does not accept any parameters.
Returns
This function does not return any values.
Parameters

name :

string

The layer name.

layer_rt :

string

The layer render target name.

Returns
This function does not return any values.

This is useful for heads-up-displays, text information, object labels and so on.

Parameters

enabled :

boolean

The enabled state flag.

Returns
This function does not return any values.
Parameters

eye :

integer

The eye to query (stingray.GearVR.EYE_LEFT or stingray.GearVR.EYE_RIGHT)

Returns

table

Table populated with eye information.

Parameters
This function does not accept any parameters.
Returns

table

Table populated with GearVR HMD information.

Parameters
This function does not accept any parameters.
Returns

stingray.Matrix4x4

Head local pose

stingray.Matrix4x4

Left eye local pose

stingray.Matrix4x4

Right eye local pose

Parameters
This function does not accept any parameters.
Returns

stingray.Matrix4x4

Head world pose

stingray.Matrix4x4

Left eye world pose

stingray.Matrix4x4

Right eye world pose

If not tracked, identity matrices are returned.

Parameters
This function does not accept any parameters.
Returns

boolean

Returns true if GearVR was initialized properly, otherwise returns false.

Parameters
This function does not accept any parameters.
Returns

gearvr_mobile_options

A table that contains the current values of the mobile options. For details on its fields and types, see gearvr_mobile_options.

Parameters
This function does not accept any parameters.
Returns

table

Table populated with current profile data set using GearVR Configuration Utility.

More specifically, it returns the player height, eye height, interpupillary and neck to eye distances in meters.

Parameters
This function does not accept any parameters.
Returns
This function does not return any values.
Parameters

name :

string

The layer name.

Returns
This function does not return any values.
Parameters

left_eye_rt :

string

The left eye render target name.

right_eye_rt :

string

The right eye render target name.

left_eye_fov_left :

number

The left eye left frustum angle.

left_eye_fov_right :

number

The left eye right frustum angle.

left_eye_fov_down :

number

The left eye down frustum angle.

left_eye_fov_up :

number

The left eye up frustum angle.

right_eye_fov_left :

number

The right eye left frustum angle.

right_eye_fov_right :

number

The right eye right frustum angle.

right_eye_fov_down :

number

The right eye down frustum angle.

right_eye_fov_up :

number

The right eye up frustum angle.

flags :

integer?

Optional; Setup flags.

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Returns
This function does not return any values.
Parameters

name :

string

The name of the layer to set to the high quality render path.

hq_enabled :

boolean

Whether or not this layer should use the high quality render path.

Returns
This function does not return any values.
Parameters

name :

string

The name of the layer to update.

width :

number

The layer quad width in meters

height :

number

The layer quad height in meters

Returns
This function does not return any values.

By default layers are rendered on a quad that is 1 meter across.

Parameters

name :

string

The name of the layer to update.

pose :

stingray.Matrix4x4

The layer center pose.

headlocked :

boolean

Whether the layer pose is relative to the HMD (headlocked) or relative to the tracking origin.

Returns
This function does not return any values.

By default, the pose is headlocked 0.5m infront of the HMD.

Parameters

name :

string

The name of the layer.

visible :

boolean

Whether or not this layer is visible.

Returns
This function does not return any values.
Parameters

options :

gearvr_mobile_options?

A table that contains the options and values you want to set. For details on its fields and types, see gearvr_mobile_options.

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Returns
This function does not return any values.

Call this function before [stingray.GearVR.setup()].

Parameters

pose :

stingray.Matrix4x4

Tracking space pose

Returns
This function does not return any values.
Parameters
This function does not accept any parameters.
Returns
This function does not return any values.
Parameters
This function does not accept any parameters.
Returns

boolean

true if the device session is valid. On desktop this happens after GearVR.initialize, on mobile this happens after GearVR.enable

Extra latency modes

These modes are used as frame parameters for the GearVR Mobile SDK.

You can set them in the extra_latency_mode field of the table that you pass to set_mobile_options(). For example:

local settings = { extra_latency_mode = stingray.GearVR.EXTRA_LATENCY_OFF }
stingray.GearVR.set_mobile_options(settings)
VRAPI_EXTRA_LATENCY_MODE_DYNAMIC
VRAPI_EXTRA_LATENCY_MODE_ON