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

stingray.SteamVR namespace reference

Description

This object provides access to the SteamVR interface.

Functions

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

controller :

integer

Controller index

button :

integer

Controller button [SteamVR.BUTTON_SYSTEM, SteamVR.BUTTON_MENU, SteamVR.BUTTON_GRIP, SteamVR.BUTTON_TOUCH and SteamVR.BUTTON_TRIGGER SteamVR.BUTTON_TOUCH_UP, SteamVR.BUTTON_TOUCH_DOWN, SteamVR.BUTTON_TOUCH_LEFT, SteamVR.BUTTON_TOUCH_RIGHT]

Returns

boolean

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

Parameters

index :

integer

Controller index

Returns

stingray.Matrix4x4

Local pose of the controller

Identity matrix is returned if controller is not tracked.

Parameters

controller :

integer

Controller index

button :

integer

Controller button [SteamVR.BUTTON_SYSTEM, SteamVR.BUTTON_MENU, SteamVR.BUTTON_GRIP, SteamVR.BUTTON_TOUCH and SteamVR.BUTTON_TRIGGER SteamVR.BUTTON_TOUCH_UP, SteamVR.BUTTON_TOUCH_DOWN, SteamVR.BUTTON_TOUCH_LEFT, SteamVR.BUTTON_TOUCH_RIGHT]

Returns

boolean

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

Parameters

index :

integer

Controller index

seconds :

number

Duration of pulse in seconds, the maximum length of a pulse is 0.003999 seconds.

Returns
This function does not return any values.

This should be called every frame you want the vibration to happen. The duration of the pulse supplied to this function is, in effect, the vibration strength.

Parameters

controller :

integer

Controller index

button :

integer

Controller button [SteamVR.BUTTON_SYSTEM, SteamVR.BUTTON_MENU, SteamVR.BUTTON_GRIP, SteamVR.BUTTON_TOUCH and SteamVR.BUTTON_TRIGGER SteamVR.BUTTON_TOUCH_UP, SteamVR.BUTTON_TOUCH_DOWN, SteamVR.BUTTON_TOUCH_LEFT, SteamVR.BUTTON_TOUCH_RIGHT]

Returns

boolean

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

Parameters

unit :

stingray.Unit

Controller unit

root :

string

Name of geometry root

material :

string

Name of material

Returns
This function does not return any values.
Parameters

controller :

integer

Controller index

button :

integer

Controller button [SteamVR.BUTTON_SYSTEM, SteamVR.BUTTON_MENU, SteamVR.BUTTON_GRIP, SteamVR.BUTTON_TOUCH and SteamVR.BUTTON_TRIGGER SteamVR.BUTTON_TOUCH_UP, SteamVR.BUTTON_TOUCH_DOWN, SteamVR.BUTTON_TOUCH_LEFT, SteamVR.BUTTON_TOUCH_RIGHT]

Returns

boolean

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

Note, only SteamVR.BUTTON_TOUCH currently has these events. If other buttons are requested, false will be returned.

Parameters

controller :

integer

Controller index

button :

integer

Controller button [SteamVR.BUTTON_SYSTEM, SteamVR.BUTTON_MENU, SteamVR.BUTTON_GRIP, SteamVR.BUTTON_TOUCH and SteamVR.BUTTON_TRIGGER SteamVR.BUTTON_TOUCH_UP, SteamVR.BUTTON_TOUCH_DOWN, SteamVR.BUTTON_TOUCH_LEFT, SteamVR.BUTTON_TOUCH_RIGHT]

Returns

boolean

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

Note, only SteamVR.BUTTON_TOUCH currently has these events. If other buttons are requested, false will be returned.

Parameters

controller :

integer

Controller index

button :

integer

Controller button [SteamVR.BUTTON_SYSTEM, SteamVR.BUTTON_MENU, SteamVR.BUTTON_GRIP, SteamVR.BUTTON_TOUCH and SteamVR.BUTTON_TRIGGER SteamVR.BUTTON_TOUCH_UP, SteamVR.BUTTON_TOUCH_DOWN, SteamVR.BUTTON_TOUCH_LEFT, SteamVR.BUTTON_TOUCH_RIGHT]

Returns

number

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

number

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

If SteamVR.BUTTON_TOUCH 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

index :

integer

Controller index

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

color :

color

Color to fade in/out

seconds :

number

Time to fade in/out

Returns
This function does not return any values.

This color is faded on top of the scene based on the alpha parameter that you pass to stingray.Color() when you create the color object you pass in the color parameter. Note that this function requires the alpha value to be the first parameter.

For example, to remove the fade color instantly, you can "fade" to a fully transparent color with a time of 0 seconds:

To fade to a semi-transparent blue over the course of 2 seconds:

stingray.SteamVR.fade_to_color(stingray.Color(127, 0, 0, 255), 2) -- Alpha = 127, Blue = 255

Or, to fade in a fully opaque white over the course of 5 seconds:

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

If not tracked, identity matrices are returned.

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 SteamVR was initialized properly, otherwise returns false.

Parameters

index :

integer

Controller index

Returns

boolean

Returns true if controller with the specified index is currently tracked, otherwise returns false.

Parameters
This function does not accept any parameters.
Returns

boolean

Returns true if HMD is currently tracked, otherwise returns false.

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.

curved :

boolean?

Optional; Whether or not to curve the layer (only in high quality rendering).

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

min_curve :

number?

Optional; Distance in meters where the layer will be most curved.

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

max_curve :

number?

Optional; Distance in meters where the layer will be least curved.

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.

Only one high quality layer is supported at a time.

Parameters

name :

string

The name of the layer to update.

width :

number

The layer quad width 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 if it's in worldspace.

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

Local position of the corner 1.

stingray.Vector3

Local position of the corner 2.

stingray.Vector3

Local position of the corner 3.

stingray.Vector3

Local position of the corner 4.

Corners are in counter-clockwise order where the standing center (0,0,0) is the center of the tracking space. The z value of every corner is 0 in local space (on the floor).

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

number

The width of the tracking space

number

The depth of the tracking space

Parameters
This function does not accept any parameters.
Returns

stingray.Vector3

World position of the corner 1.

stingray.Vector3

World position of the corner 2.

stingray.Vector3

World position of the corner 3.

stingray.Vector3

World position of the corner 4.

Corners are in counter-clockwise order and are centered around the defined tracking space pose.