This object provides access to the Oculus interface.
Other related reference items
camera ( ) : stingray.Camera
Returns the current camera used by Oculus.
|
This function does not accept any parameters. |
Returns the camera currently used by the active Oculus session. |
This function does not accept any parameters. |
This function does not return any values. |
clear_layers ( )
Clears all layers
|
This function does not accept any parameters. |
This function does not return any values. |
controller_held ( controller, button ) : boolean
Returns true or false depending if the specified button is held this frame for a given controller.
|
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] |
boolean |
Returns true if specified button is held on controller, false otherwise. |
controller_local_pose ( controller ) : stingray.Matrix4x4
Returns the local pose of the specified controller.
|
controller : | integer |
Tracked controller type [Oculus.CONTROLLER_LEFT_TOUCH or Oculus.CONTROLLER_RIGHT_TOUCH] |
Local pose of the controller |
Identity matrix is returned if controller is not tracked.
controller_pressed ( controller, button ) : boolean
Returns true or false depending if the specified button is pressed this frame for a given controller.
|
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] |
boolean |
Returns true if specified button is pressed on controller, false otherwise. |
controller_pulse ( controller, frequency, amplitude )
Triggers a haptic pulse on the specified controller.
|
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 |
This function does not return any values. |
controller_released ( controller, button ) : number, number
Returns the analog values of a specified controller button.
|
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_LTHUMBREST, BUTTON_LTHUMB, Oculus.BUTTON_UP, Oculus.BUTTON_DOWN, Oculus.BUTTON_LEFT, Oculus.BUTTON_RIGHT, Oculus.BUTTON_ENTER, Oculus.BUTTON_BACK] |
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.
controller_released ( controller, button ) : boolean
Returns true or false depending if the specified button has been released this frame for a given controller.
|
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] |
boolean |
Returns true if specified button is released on controller, false otherwise. |
controller_touched ( touch ) : boolean
Returns true or false depending if the specified button is touched.
|
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_LTHUMBREST, Oculus.TOUCH_LTHUMBUP, Oculus.TOUCH_LTRIGGER, Oculus.TOUCH_LPOINTING ] |
boolean |
Returns true if specified button is touched on the controller, false otherwise. |
Note only OCULUS TOUCH controllers have touch functionality.
controller_touched ( touch ) : boolean
Returns true or false depending if the specified button has been untouched this frame.
|
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_LTHUMBREST, Oculus.TOUCH_LTHUMBUP, Oculus.TOUCH_LTRIGGER, Oculus.TOUCH_LPOINTING ] |
boolean |
Returns true if specified button is touched on the controller, false otherwise. |
Note only OCULUS TOUCH controllers have touch functionality.
controller_world_pose ( controller ) : stingray.Matrix4x4
Returns the world pose of the specified controller.
|
controller : | integer |
Tracked controller type [Oculus.CONTROLLER_LEFT_TOUCH or Oculus.CONTROLLER_RIGHT_TOUCH] |
World pose of the controller |
Identity matrix is returned if controller is not tracked.
create_layer ( name, layer_rt )
Creates a monoscopic image that is displayed as a rectangle headlocked in front of the HMD.
|
name : | string |
The layer name. |
layer_rt : | string |
The layer render target name. |
This function does not return any values. |
This is useful for heads-up-displays, text information, object labels and so on.
enable ( enabled )
Enables or disables rendering to the Oculus device.
|
enabled : | boolean |
The enabled state flag. |
This function does not return any values. |
eye_info ( eye ) : table
Returns a table containing information on the specified eye.
|
eye : | integer |
The eye to query (stingray.Oculus.EYE_LEFT or stingray.Oculus.EYE_RIGHT) |
table |
Table populated with eye information. |
hmd_info ( ) : table
Returns a table containing HMD information.
|
This function does not accept any parameters. |
table |
Table populated with Oculus HMD information. |
hmd_local_pose ( ) : stingray.Matrix4x4, stingray.Matrix4x4, stingray.Matrix4x4
Returns 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.Matrix4x4
Returns 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 ( render_target, camera, world, flags, window ) : boolean
Initializes Oculus VR system.
|
render_target : | string |
The stereo render target name. |
camera : |
The camera used for stereo rendering. | |
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. |
window : |
Optional; Specify which window will be used to render VR (useful for multi window applications) The ? notation indicates that this type is optional: there may be zero or one instances of it. |
boolean |
Returns true if Oculus VR was initialized properly, otherwise returns false. |
is_hmd_present ( ) : boolean |
This function does not accept any parameters. |
boolean |
true if there is an Oculus HMD connected, false otherwise. |
link_node_to_tracker ( unit, node, world, device_type, index )
Links a Unit node to be automatically updated by the VR tracker.
|
unit : |
Unit to link to tracker | |
node : | integer |
Scene graph node that is linked within the unit |
world : |
World containing the unit | |
device_type : | integer |
Device type (Oculus.DEVICE_HMD or Oculus.DEVICE_CONTROLLER) |
index : | integer? |
Optional index when using Oculus.DEVICE_HMD (Oculus.EYE_LEFT or Oculus.EYE_RIGHT, omitting the index will simply link to HMD), or controller index when using Oculus.DEVICE_CONTROLLER (Oculus.CONTROLLER_LEFT_TOUCH or Oculus.CONTROLLER_RIGHT_TOUCH) The ? notation indicates that this type is optional: there may be zero or one instances of it. |
This function does not return any values. |
profile ( ) : table
Returns a table containing the current active profile data.
|
This function does not accept any parameters. |
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.
recenter ( )
Re-centers the sensor position and orientation.
|
This function does not accept any parameters. |
This function does not return any values. |
remove_layer ( name )
Removes the specified layer.
|
name : | string |
The layer name. |
This function does not return any values. |
set_camera ( camera, world )
Sets a new camera for Oculus VR.
|
camera : |
The camera used for stereo rendering. | |
world : |
The world containing the camera. |
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
set_high_quality_layer ( name, hq_enabled )
Enable or disable 4x anisotropic sampling in the compositor for the specified layer.
|
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. |
This function does not return any values. |
set_layer_dimensions ( name, width, height )
Sets the dimensions of the layer quad.
|
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 |
This function does not return any values. |
By default layers are rendered on a quad that is 1 meter across.
set_layer_pose ( name, pose, headlocked )
Sets the layer pose.
|
name : | string |
The name of the layer to update. |
pose : |
The layer center pose. | |
headlocked : | boolean |
Whether the layer pose is relative to the HMD (headlocked) or relative to the tracking origin. |
This function does not return any values. |
By default, the pose is headlocked 0.5m infront of the HMD.
set_layer_visibility ( name, visible )
Specify if a layer should be visible or hidden.
|
name : | string |
The name of the layer. |
visible : | boolean |
Whether or not this layer is visible. |
This function does not return any values. |
set_tracking_origin ( ) : boolean
Sets the tracking local origin to eye level or floor level.
|
This function does not accept any parameters. |
boolean |
if the tracking local origin was set properly, false otherwise. |
set_tracking_space ( position, rotation, scale )
Sets tracking space pose
|
position : |
Tracking space position | |
rotation : |
Tracking space rotation | |
scale : |
Tracking space scale |
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. |
DEPRECATED: Use OculusVR.set_tracking_space(Vector3, Quaternion, Vector3) instead.
shutdown ( )
Shuts down Oculus VR system.
|
This function does not accept any parameters. |
This function does not return any values. |
tracking_space_pose ( ) : stingray.Matrix4x4
Returns the tracking space pose
|
This function does not accept any parameters. |
Tracking space pose |
tracking_space_scale ( ) : stingray.Vector3
Returns the tracking space scale
|
This function does not accept any parameters. |
Tracking space scale |
unlink_node_from_tracker ( unit, node )
Unlinks a Unit node that is being automatically updated by the VR tracker.
|
unit : |
Unit to unlink from the VR tracker | |
node : | integer |
Scene graph node within the unit that is to be unlinked |
This function does not return any values. |
valid_session ( ) : boolean |
This function does not accept any parameters. |
boolean |
true if the device session is valid. |