This object provides access to the Google VR interface.
Other related reference items
compute_distorted_point ( eye, point ) : stingray.Vector2+Computes the distorted point for a given point in a given eye, if possible.
|
eye : | integer | The eye to query (stingray.GoogleVR.LEFT_EYE or stingray.GoogleVR.RIGHT_EYE) |
point : | a point in screen eye Viewport Space in [0,1]^2 with (0, 0) in the lower left corner of the eye's viewport and (1, 1) in the upper right corner of the eye's viewport |
Returns three Vector2 with the red, green and blue distorted points. The + notation indicates that there may be one or more instances of the specified type. |
The distortion inverts the optical distortion caused by the lens for the eye. Due to chromatic aberration, the distortion is different for each color channel.
controller_acceleration ( ) : stingray.Vector3Returns the acceleration direction feels in meters per second squared (m/s^2) this frame for the current controller.
|
This function does not accept any parameters. |
Acceleration direction in meters per second squared of the controller |
controller_api_status ( ) : integerReturns the API status of the controller.
|
This function does not accept any parameters. |
integer |
The API status of the controller [GoogleVR.STATUS_API_OK, GoogleVR.STATUS_API_UNSUPPORTED, GoogleVR.STATUS_API_NOT_AUTHORIZED, GoogleVR.STATUS_API_UNAVAILABLE, GoogleVR.STATUS_API_SERVICE_OBSOLETE, GoogleVR.STATUS_API_CLIENT_OBSOLETE, GoogleVR.STATUS_API_MALFUNCTION] |
controller_api_status_string ( status ) : stringReturns the API status of the controller as a string.
|
status : | integer | Controller API status [GoogleVR.STATUS_API_OK, GoogleVR.STATUS_API_UNSUPPORTED, GoogleVR.STATUS_API_NOT_AUTHORIZED, GoogleVR.STATUS_API_UNAVAILABLE, GoogleVR.STATUS_API_SERVICE_OBSOLETE, GoogleVR.STATUS_API_CLIENT_OBSOLETE, GoogleVR.STATUS_API_MALFUNCTION] |
string |
The API status of the controller as a string |
controller_connection_status ( ) : integerReturns the connection status of the controller.
|
This function does not accept any parameters. |
integer |
The connection status of the controller [GoogleVR.STATUS_DISCONNECTED, GoogleVR.STATUS_SCANNING, GoogleVR.STATUS_CONNECTING, GoogleVR.STATUS_CONNECTED] |
controller_connection_status_string ( status ) : stringReturns the connection status of the controller as a string.
|
status : | integer | Controller connection status [GoogleVR.STATUS_DISCONNECTED, GoogleVR.STATUS_SCANNING, GoogleVR.STATUS_CONNECTING, GoogleVR.STATUS_CONNECTED] |
string |
The connection status of the controller as a string |
controller_gyroscope ( ) : stingray.Vector3Returns the current controller angular speed in radians.
|
This function does not accept any parameters. |
Angular speed in radians of the controller |
controller_held ( button ) : booleanIndicates if the specified button is currently held.
|
button : | integer | Controller button [GoogleVR.BUTTON_CLICK, GoogleVR.BUTTON_HOME, GoogleVR.BUTTON_APP, GoogleVR.BUTTON_VOLUME_UP, GoogleVR.BUTTON_VOLUME_DOWN] |
boolean |
true if specified button is held on the controller, false otherwise |
controller_orientation ( ) : stingray.QuaternionReturns the current controller orientation.
|
This function does not accept any parameters. |
Orientation of the controller |
controller_pressed ( button ) : booleanIndicates if the specified button has been pressed this frame.
|
button : | integer | Controller button [GoogleVR.BUTTON_CLICK, GoogleVR.BUTTON_HOME, GoogleVR.BUTTON_APP, GoogleVR.BUTTON_VOLUME_UP, GoogleVR.BUTTON_VOLUME_DOWN] |
boolean |
true if specified button is pressed on controller, false otherwise. |
This is a "transient" result; when it is true it will be true for only one frame after the event, and false for calls in subsequent frames.
controller_released ( button ) : booleanIndicates if the specified button has been released this frame for a given controller.
|
button : | integer | Controller button [GoogleVR.BUTTON_CLICK, GoogleVR.BUTTON_HOME, GoogleVR.BUTTON_APP, GoogleVR.BUTTON_VOLUME_UP, GoogleVR.BUTTON_VOLUME_DOWN] |
boolean |
true if specified button is released on controller, false otherwise. |
This is a "transient" result; when it is true it will be true for only one frame after the event, and false for calls in subsequent frames.
controller_touch ( ) : booleanReturns true or false depending if the touchpad is being touched this frame for the current controller.
|
This function does not accept any parameters. |
boolean |
True if touchpad is touched on the controller, false otherwise |
controller_touched ( ) : booleanIndicates if the touchpad has begun to be touched this frame.
|
This function does not accept any parameters. |
boolean |
true if user just started touching the touchpad, false otherwise. |
This is a "transient" result; when it is true it will be true for only one frame after the event, and false for calls in subsequent frames.
controller_touch_position ( ) : stingray.Vector2Returns current or last touch position in normalized coordinates (0,0 top left, 1,1 bottom right) depending if the touchpad is being touched for the current controller.
|
This function does not accept any parameters. |
Touch position in normalized coordinates of the controller's touchpad |
controller_untouched ( ) : booleanIndicates if the touchpad has stopped being touched this frame.
|
This function does not accept any parameters. |
boolean |
true if user just stopped touching the touchpad, false otherwise. |
This is a "transient" result; when it is true it will be true for only one frame after the event, and false for calls in subsequent frames.
controller_value ( controller, button ) : number, numberReturns the analog values of a specified controller button.
|
controller : | integer | Controller index (Unused for GoogleVR, set to 0) |
button : | integer | Controller button [GoogleVR.BUTTON_CLICK, GoogleVR.BUTTON_HOME, GoogleVR.BUTTON_APP, GoogleVR.BUTTON_VOLUME_UP, GoogleVR.BUTTON_VOLUME_DOWN] |
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 GoogleVR.BUTTON_CLICK is requested, x and y analog positions of the touchpad 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.
eye_fov ( eye ) : tableReturns a table containing field of view on the specified eye.
|
eye : | integer | The eye to query (stingray.GoogleVR.LEFT_EYE or stingray.GoogleVR.RIGHT_EYE) |
table |
Table populated with eye field of view. |
hide_ui_overlay ( )Hides the GoogleVR UI overlay that includes the divider bar, the settings button, and the back button.
|
This function does not accept any parameters. |
This function does not return any values. |
hmd_info ( ) : tableReturns a table containing HMD information.
|
This function does not accept any parameters. |
table |
Table populated with GoogleVR HMD information. |
The "type" field identifies the viewer type as "Cardboard", "Daydream", or "unknown".
hmd_local_pose ( ) : stingray.Matrix4x4, stingray.Matrix4x4, stingray.Matrix4x4Returns the head, left eye and right eye local poses of the HMD.
|
This function does not accept any parameters. |
Head local pose | |
Left eye local pose | |
Right eye local pose |
hmd_world_pose ( ) : stingray.Matrix4x4, stingray.Matrix4x4, stingray.Matrix4x4Returns the head, left eye and right eye world poses of the HMD.
|
This function does not accept any parameters. |
Head world pose | |
Left eye world pose | |
Right eye world pose |
If not tracked, identity matrices are returned.
initialize ( ) : booleanInitializes Google VR system.
|
This function does not accept any parameters. |
boolean |
Returns true if Google VR was initialized properly, otherwise returns false. |
This function does not accept any parameters. |
This function does not return any values. |
link_node_to_eye ( unit, node, eye, world )Links a Unit node to be automatically updated by the VR tracker.
|
unit : | Unit to link to eye | |
node : | integer | Scene graph node that is linked within the unit |
eye : | integer | The eye to link (stingray.GoogleVR.LEFT_EYE or stingray.GoogleVR.RIGHT_EYE) |
world : | World containing the unit |
This function does not return any values. |
recenter ( )Re-centers the head orientation (resets the yaw to zero, leaving pitch and roll unmodified).
|
This function does not accept any parameters. |
This function does not return any values. |
Does nothing on daydream devices (re-centering is handled automatically).
This function does not accept any parameters. |
This function does not return any values. |
setup_render_targets ( left_eye_rt, right_eye_rt )Setup Google VR render targets.
|
left_eye_rt : | string | The left eye render target name. |
right_eye_rt : | string | The right eye render target name. |
This function does not return any values. |
set_default_viewer_profile ( uri )Sets the default viewer profile specified by uri.
|
uri : | string | A string that contains either the shortened URI or the standard URI representing the viewer profile that the app should be using. |
This function does not return any values. |
set_tracking_space_pose ( pose )Sets provided pose as the default tracking space pose
|
pose : | Tracking space pose |
This function does not return any values. |
show_ui_overlay ( )Shows the GoogleVR UI overlay that includes the divider bar, the settings button, and the back button.
|
This function does not accept any parameters. |
This function does not return any values. |
shutdown ( )Shuts down Google VR system.
|
This function does not accept any parameters. |
This function does not return any values. |
unlink_eye ( eye )Unlinks a any Unit node that is being automatically updated by the VR tracker.
|
eye : | integer | The eye to unlink (stingray.GoogleVR.LEFT_EYE or stingray.GoogleVR.RIGHT_EYE) |
This function does not return any values. |