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

stingray.Oculus namespace reference

Description

This object provides access to the Oculus interface.

Functions

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

controller :

integer

Controller type [Oculus.CONTROLLER_LEFT_TOUCH, Oculus.CONTROLLER_RIGHT_TOUCH, Oculus.CONTROLLER_REMOTE, Oculus.CONTROLLER_XBOX]

button :

integer

Controller button [Oculus.BUTTON_A, Oculus.BUTTON_B, Oculus.BUTTON_X, Oculus.BUTTON_Y, Oculus.BUTTON_RTRIGGER, Oculus.BUTTON_RSHOULDER, BUTTON_RTHUMB, Oculus.BUTTON_LTRIGGER, Oculus.BUTTON_LSHOULDER, BUTTON_LTHUMB, Oculus.BUTTON_UP, Oculus.BUTTON_DOWN, Oculus.BUTTON_LEFT, Oculus.BUTTON_RIGHT, Oculus.BUTTON_ENTER, Oculus.BUTTON_BACK]

Returns

boolean

Returns true if specified button is held on controller, false otherwise.

Parameters

controller :

integer

Tracked controller type [Oculus.CONTROLLER_LEFT_TOUCH or Oculus.CONTROLLER_RIGHT_TOUCH]

Returns

stingray.Matrix4x4

Local pose of the controller

Identity matrix is returned if controller is not tracked.

Parameters

controller :

integer

Controller type [Oculus.CONTROLLER_LEFT_TOUCH, Oculus.CONTROLLER_RIGHT_TOUCH, Oculus.CONTROLLER_REMOTE, Oculus.CONTROLLER_XBOX]

button :

integer

Controller button [Oculus.BUTTON_A, Oculus.BUTTON_B, Oculus.BUTTON_X, Oculus.BUTTON_Y, Oculus.BUTTON_RTRIGGER, Oculus.BUTTON_RSHOULDER, BUTTON_RTHUMB, Oculus.BUTTON_LTRIGGER, Oculus.BUTTON_LSHOULDER, BUTTON_LTHUMB, Oculus.BUTTON_UP, Oculus.BUTTON_DOWN, Oculus.BUTTON_LEFT, Oculus.BUTTON_RIGHT, Oculus.BUTTON_ENTER, Oculus.BUTTON_BACK]

Returns

boolean

Returns true if specified button is pressed on controller, false otherwise.

Parameters

controller :

integer

Controller type [Oculus.CONTROLLER_LEFT_TOUCH, Oculus.CONTROLLER_RIGHT_TOUCH, Oculus.CONTROLLER_XBOX]

frequency :

number

Pulse frequency in the range of 0.0 to 1.0. Currently the only valid values are 0.0, 0.5, and 1.0, other values will be clamped to one of these.

amplitude :

number

Pulse amplitude in the range of 0.0 to 1.0

Returns
This function does not return any values.
Parameters

controller :

integer

Controller type [Oculus.CONTROLLER_LEFT_TOUCH, Oculus.CONTROLLER_RIGHT_TOUCH, Oculus.CONTROLLER_REMOTE, Oculus.CONTROLLER_XBOX]

button :

integer

Controller button [Oculus.BUTTON_A, Oculus.BUTTON_B, Oculus.BUTTON_X, Oculus.BUTTON_Y, Oculus.BUTTON_RTRIGGER, Oculus.BUTTON_RSHOULDER, BUTTON_RTHUMB, Oculus.BUTTON_LTRIGGER, Oculus.BUTTON_LSHOULDER, BUTTON_LTHUMB, Oculus.BUTTON_UP, Oculus.BUTTON_DOWN, Oculus.BUTTON_LEFT, Oculus.BUTTON_RIGHT, Oculus.BUTTON_ENTER, Oculus.BUTTON_BACK]

Returns

number

First analog value of specified controller button. If value is unused, 0.0 is returned.

number

Second analog value of specified controller button. If value is unused, 0.0 is returned.

If Oculus.BUTTON_RTHUMB or Oculus BUTTON_LTHUMB is requested, x and y analog positions will be returned. Otherwise, for any other button, the first value will contain the analog value (varying between 0 and 1) while the second will always be 0.

Parameters

controller :

integer

Controller type [Oculus.CONTROLLER_LEFT_TOUCH, Oculus.CONTROLLER_RIGHT_TOUCH, Oculus.CONTROLLER_REMOTE, Oculus.CONTROLLER_XBOX]

button :

integer

Controller button [Oculus.BUTTON_A, Oculus.BUTTON_B, Oculus.BUTTON_X, Oculus.BUTTON_Y, Oculus.BUTTON_RTRIGGER, Oculus.BUTTON_RSHOULDER, BUTTON_RTHUMB, Oculus.BUTTON_LTRIGGER, Oculus.BUTTON_LSHOULDER, BUTTON_LTHUMB, Oculus.BUTTON_UP, Oculus.BUTTON_DOWN, Oculus.BUTTON_LEFT, Oculus.BUTTON_RIGHT, Oculus.BUTTON_ENTER, Oculus.BUTTON_BACK]

Returns

boolean

Returns true if specified button is released on controller, false otherwise.

Parameters

touch :

integer

The controller button being touched [ Oculus.TOUCH_A, Oculus.TOUCH_B, Oculus.TOUCH_RTHUMB, Oculus.TOUCH_RTHUMBREST, Oculus.TOUCH_RTHUMBUP, Oculus.TOUCH_RTRIGGER, Oculus.TOUCH_RPOINTING, Oculus.TOUCH_X, Oculus.TOUCH_Y, Oculus.TOUCH_LTHUMB, Oculus.TOUCH_LSHOULDER, Oculus.TOUCH_LTHUMBUP, Oculus.TOUCH_LTRIGGER, Oculus.TOUCH_LPOINTING ]

Returns

boolean

Returns true if specified button is touched on the controller, false otherwise.

Note only OCULUS TOUCH controllers have touch functionality.

Parameters

touch :

integer

The controller button being touched [ Oculus.TOUCH_A, Oculus.TOUCH_B, Oculus.TOUCH_RTHUMB, Oculus.TOUCH_RTHUMBREST, Oculus.TOUCH_RTHUMBUP, Oculus.TOUCH_RTRIGGER, Oculus.TOUCH_RPOINTING, Oculus.TOUCH_X, Oculus.TOUCH_Y, Oculus.TOUCH_LTHUMB, Oculus.TOUCH_LSHOULDER, Oculus.TOUCH_LTHUMBUP, Oculus.TOUCH_LTRIGGER, Oculus.TOUCH_LPOINTING ]

Returns

boolean

Returns true if specified button is touched on the controller, false otherwise.

Note only OCULUS TOUCH controllers have touch functionality.

Parameters

controller :

integer

Tracked controller type [Oculus.CONTROLLER_LEFT_TOUCH or Oculus.CONTROLLER_RIGHT_TOUCH]

Returns

stingray.Matrix4x4

World pose of the controller

Identity matrix is returned if controller is not tracked.

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.Oculus.EYE_LEFT or stingray.Oculus.EYE_RIGHT)

Returns

table

Table populated with eye information.

Parameters
This function does not accept any parameters.
Returns

table

Table populated with Oculus 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

render_target :

string

The stereo render target name.

camera :

stingray.Camera

The camera used for stereo rendering.

world :

stingray.World

The world containing the camera.

flags :

integer?

Optional; Initialization flags.

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Returns

boolean

Returns true if Oculus VR was initialized properly, otherwise returns false.

Parameters
This function does not accept any parameters.
Returns

table

Table populated with current profile data set using Oculus 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

camera :

stingray.Camera

The camera used for stereo rendering.

world :

stingray.World

The world containing the camera.

Returns
This function does not return any values.

This is useful, when you create a new world in your game and want to transition to it in VR

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

position :

stingray.Vector3

Tracking space position

rotation :

stingray.Quaternion

Tracking space rotation

scale :

stingray.Vector3

Tracking space scale

Returns
This function does not return any values.
Parameters

pose :

stingray.Matrix4x4

Tracking space pose

Returns
This function does not return any values.

DEPRECATED: Use OculusVR.set_tracking_space(Vector3, Quaternion, Vector3) instead.

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

stingray.Matrix4x4

Tracking space pose

Parameters
This function does not accept any parameters.
Returns

stingray.Vector3

Tracking space scale

Parameters
This function does not accept any parameters.
Returns

boolean

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