Description
Supported Script Types: Interface Scripts • Client Entity Scripts • Avatar Scripts
TheHMD
API provides access to the HMD used in VR display mode.Properties
Name | Type | Summary |
---|---|---|
position | Vec3 |
The position of the HMD if currently in VR display mode, otherwise Vec3.ZERO. Read-only. |
orientation | Quat |
The orientation of the HMD if currently in VR display mode, otherwise Quat.IDENTITY. Read-only. |
active | boolean |
|
mounted | boolean |
|
playerHeight | number |
The real-world height of the user. Read-only. Currently always returns a
value of |
eyeHeight | number |
The real-world height of the user's eyes. Read-only. Currently always returns a
value of |
ipd | number |
The inter-pupillary distance (distance between eyes) of the user, used for rendering. Defaults to
the human average of |
ipdScale | number |
A scale factor applied to the Default Value: 1.0 |
showTablet | boolean |
|
tabletContextualMode | boolean |
|
tabletID | Uuid |
The UUID of the tablet body model entity. |
tabletScreenID | Uuid |
The UUID of the tablet's screen entity. |
homeButtonID | Uuid |
The UUID of the tablet's "home" button entity. |
homeButtonHighlightID | Uuid |
The UUID of the tablet's "home" button highlight entity. |
miniTabletID | Uuid |
The UUID of the mini tablet's body model entity. |
miniTabletScreenID | Uuid |
The UUID of the mini tablet's screen entity. |
miniTabletHand | number |
The hand that the mini tablet is displayed on: |
miniTabletEnabled | boolean |
Default Value: true |
playArea | Rect |
The size and position of the HMD play area in sensor coordinates. Read-only. Default Value: 0,0,0,0 |
sensorPositions | Array.<Vec3> |
The positions of the VR system sensors in sensor coordinates. Read-only. Default Value: [] |
visionSqueezeRatioX | number |
The amount of vision squeeze for the x-axis when moving, range Default Value: 0.0 |
visionSqueezeRatioY | number |
The amount of vision squeeze for the y-axis when moving, range Default Value: 0.0 |
visionSqueezeTurningXFactor | number |
The additional amount of vision squeeze for the x-axis when turning,
range Default Value: 0.51 |
visionSqueezeTurningYFactor | number |
Currently unused. Default Value: 0.36 |
visionSqueezeUnSqueezeDelay | number |
The delay in undoing the vision squeeze effect after motion stops, in seconds. Default Value: 0.2 |
visionSqueezeUnSqueezeSpeed | number |
How quickly the vision squeeze effect fades, once
Default Value: 3.0 |
visionSqueezeTransition | number |
How tightly vision is squeezed, range Default Value: 0.25 |
visionSqueezePerEye | number |
Default Value: 1 |
visionSqueezeGroundPlaneY | number |
Adjusts how far below the camera the vision squeeze grid is displayed at. Default Value: 0.0 |
visionSqueezeSpotlightSize | number |
The diameter of the circle of vision squeeze grid that is illuminated around the camera. Default Value: 6.0 |
Methods
Name | Return Value | Summary |
---|---|---|
activateHMDHandMouse
|
None |
Causes the borders in HUD windows to be enlarged when the laser intersects them in HMD mode. By default, borders are not enlarged. |
calculateRayUICollisionPoint
|
Vec3 |
Calculates the intersection of a ray with the HUD overlay. |
centerUI
|
None |
Recenters the HMD HUD to the current HMD position and orientation. |
closeTablet
|
None |
Closes the tablet if it is open. |
deactivateHMDHandMouse
|
None |
Causes the border in HUD windows to no longer be enlarged when the laser intersects them in HMD mode. By default, borders are not enlarged. |
getHUDLookAtPosition2D
|
Vec2 |
Gets the position on the HUD overlay that your HMD is looking at, in HUD coordinates. |
getHUDLookAtPosition3D
|
Vec3 |
Gets the position on the HUD overlay that your HMD is looking at, in world coordinates. |
isHandControllerAvailable
|
boolean |
Checks whether there are HMD hand controllers available. |
isHeadControllerAvailable
|
boolean |
Checks whether there is an HMD head controller available. |
isHMDAvailable
|
boolean |
Checks whether there is an HMD available. |
isKeyboardVisible
|
boolean |
Checks whether the HMD-provided keyboard, if any, is visible. |
isSubdeviceContainingNameAvailable
|
boolean |
Checks whether there are specific HMD controllers available. |
openTablet
|
None |
Opens the tablet if the tablet is used in the current display mode and it isn't already showing, and sets the tablet to contextual mode if requested. In contextual mode, the page displayed on the tablet is wholly controlled by script (i.e., the user cannot navigate to another). |
overlayFromWorldPoint
|
Vec2 |
Gets the 2D HUD overlay coordinates of a 3D point on the HUD overlay. 2D HUD overlay coordinates are pixels with the origin at the top left of the overlay. |
overlayToSpherical
|
Vec2 |
Gets the spherical coordinates of a 2D point on the HUD overlay.
2D HUD overlay coordinates are pixels with the origin at the top left of the overlay.
Spherical coordinates are polar coordinates in radians with |
preferredAudioInput
|
string |
Gets the name of the HMD audio input device. |
preferredAudioOutput
|
string |
Gets the name of the HMD audio output device. |
requestHideHandControllers
|
None |
Signals that it is no longer necessary to display models of the HMD hand controllers being used. If no other scripts want the models displayed then they are no longer displayed. |
requestShowHandControllers
|
None |
Signals that models of the HMD hand controllers being used should be displayed. The models are displayed at their actual, real-world locations. |
shouldShowHandControllers
|
boolean |
Checks whether any script wants models of the HMD hand controllers displayed. Requests are made and canceled using requestShowHandControllers and requestHideHandControllers. |
sphericalToOverlay
|
Vec2 |
Gets the 2D point on the HUD overlay represented by given spherical coordinates.
2D HUD overlay coordinates are pixels with the origin at the top left of the overlay.
Spherical coordinates are polar coordinates in radians with |
suppressKeyboard
|
boolean |
Suppresses the activation of the HMD-provided keyboard, if any. Successful calls should be balanced with a call to unsuppressKeyboard within a reasonable amount of time. |
unsuppressKeyboard
|
None |
Unsuppresses the activation of the HMD-provided keyboard, if any. |
worldPointFromOverlay
|
Vec3 |
Gets the 3D world coordinates of a 2D point on the HUD overlay. 2D HUD overlay coordinates are pixels with the origin at the top left of the overlay. |
Signals
Name | Summary |
---|---|
awayStateWhenFocusLostInVRChanged
|
Triggered when the altering the mode for going into an away state when the interface focus is lost in VR. |
displayModeChanged
|
Triggered when Interface's display mode changes and when the user puts on or takes off their HMD. |
IPDScaleChanged
|
Triggered when the |
miniTabletEnabledChanged
|
Triggered when the ability to display the mini tablet has changed. |
mountedChanged
|
Triggered when the |
shouldShowHandControllersChanged
|
Triggered when a request to show or hide models of the HMD hand controllers is made using requestShowHandControllers or requestHideHandControllers. |
showTabletChanged
|
Triggered when the tablet is shown or hidden. |
Method Details
(static) activateHMDHandMouse( ) |
---|
Causes the borders in HUD windows to be enlarged when the laser intersects them in HMD mode. By default, borders are not enlarged. |
(static) calculateRayUICollisionPoint( position, direction ) → {Vec3}
Returns: The point of intersection with the HUD overlay if it intersects, otherwise Vec3.ZERO. |
|||||||||
---|---|---|---|---|---|---|---|---|---|
Calculates the intersection of a ray with the HUD overlay. Parameters
Example
|
(static) centerUI( ) |
---|
Recenters the HMD HUD to the current HMD position and orientation. |
(static) closeTablet( ) |
---|
Closes the tablet if it is open. |
(static) deactivateHMDHandMouse( ) |
---|
Causes the border in HUD windows to no longer be enlarged when the laser intersects them in HMD mode. By default, borders are not enlarged. |
(static) getHUDLookAtPosition2D( ) → {Vec2}
Returns: The position on the HUD overlay that your HMD is looking at, in pixels. |
---|
Gets the position on the HUD overlay that your HMD is looking at, in HUD coordinates. |
(static) getHUDLookAtPosition3D( ) → {Vec3}
Returns: The position on the HUD overlay the your HMD is looking at, in world coordinates. |
---|
Gets the position on the HUD overlay that your HMD is looking at, in world coordinates. |
(static) isHandControllerAvailable( nameopt ) → {boolean}
Returns: true if an HMD hand controller of the specified name is available,
otherwise false .
|
||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Checks whether there are HMD hand controllers available. Parameters
Example
|
(static) isHeadControllerAvailable( nameopt ) → {boolean}
Returns: true if an HMD head controller of the specified name is available,
otherwise false .
|
||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Checks whether there is an HMD head controller available. Parameters
Example
|
(static) isHMDAvailable( nameopt ) → {boolean}
Returns: true if an HMD of the specified name is available, otherwise
false .
|
||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Checks whether there is an HMD available. Parameters
Example
|
(static) isKeyboardVisible( ) → {boolean}
Returns: true if the current HMD provides a keyboard and it is visible, otherwise
false .
|
---|
Checks whether the HMD-provided keyboard, if any, is visible. |
(static) isSubdeviceContainingNameAvailable( name ) → {boolean}
Returns: true if an HMD controller with a name containing the specified name is
available, otherwise false .
|
||||||
---|---|---|---|---|---|---|
Checks whether there are specific HMD controllers available. Parameters
Example
|
(static) openTablet( contextualModeopt ) | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Opens the tablet if the tablet is used in the current display mode and it isn't already showing, and sets the tablet to contextual mode if requested. In contextual mode, the page displayed on the tablet is wholly controlled by script (i.e., the user cannot navigate to another). Parameters
|
(static) overlayFromWorldPoint( position ) → {Vec2}
Returns: The point on the HUD overlay in HUD coordinates. |
||||||
---|---|---|---|---|---|---|
Gets the 2D HUD overlay coordinates of a 3D point on the HUD overlay. 2D HUD overlay coordinates are pixels with the origin at the top left of the overlay. Parameters
Example
|
(static) overlayToSpherical( overlayPos ) → {Vec2}
Returns: The point on the HUD overlay in spherical coordinates. |
||||||
---|---|---|---|---|---|---|
Gets the spherical coordinates of a 2D point on the HUD overlay.
2D HUD overlay coordinates are pixels with the origin at the top left of the overlay.
Spherical coordinates are polar coordinates in radians with Parameters
|
(static) preferredAudioInput( ) → {string}
Returns: The name of the HMD audio input device if in HMD mode, otherwise an empty string. |
---|
Gets the name of the HMD audio input device. |
(static) preferredAudioOutput( ) → {string}
Returns: The name of the HMD audio output device if in HMD mode, otherwise an empty string. |
---|
Gets the name of the HMD audio output device. |
(static) requestHideHandControllers( ) |
---|
Signals that it is no longer necessary to display models of the HMD hand controllers being used. If no other scripts want the models displayed then they are no longer displayed. |
(static) requestShowHandControllers( ) |
---|
Signals that models of the HMD hand controllers being used should be displayed. The models are displayed at their actual, real-world locations. Example
|
(static) shouldShowHandControllers( ) → {boolean}
Returns: true if any script is requesting that HMD hand controller models be displayed.
|
---|
Checks whether any script wants models of the HMD hand controllers displayed. Requests are made and canceled using requestShowHandControllers and requestHideHandControllers. |
(static) sphericalToOverlay( sphericalPos ) → {Vec2}
Returns: The point on the HUD overlay in HUD coordinates. |
||||||
---|---|---|---|---|---|---|
Gets the 2D point on the HUD overlay represented by given spherical coordinates.
2D HUD overlay coordinates are pixels with the origin at the top left of the overlay.
Spherical coordinates are polar coordinates in radians with Parameters
|
(static) suppressKeyboard( ) → {boolean}
Returns: true if the current HMD provides a keyboard and it was successfully suppressed (e.g., it
isn't being displayed), otherwise false .
|
---|
Suppresses the activation of the HMD-provided keyboard, if any. Successful calls should be balanced with a call to unsuppressKeyboard within a reasonable amount of time. |
(static) unsuppressKeyboard( ) |
---|
Unsuppresses the activation of the HMD-provided keyboard, if any. |
(static) worldPointFromOverlay( coordinates ) → {Vec3}
Returns: The point on the HUD overlay in world coordinates. |
||||||
---|---|---|---|---|---|---|
Gets the 3D world coordinates of a 2D point on the HUD overlay. 2D HUD overlay coordinates are pixels with the origin at the top left of the overlay. Parameters
|
Signal Details
awayStateWhenFocusLostInVRChanged(
enabled
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when the altering the mode for going into an away state when the interface focus is lost in VR. Parameters
|
displayModeChanged(
isHMDMode
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when Interface's display mode changes and when the user puts on or takes off their HMD. Parameters
Example
|
IPDScaleChanged(
)
Returns: Signal |
---|
Triggered when the |
miniTabletEnabledChanged(
enabled
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when the ability to display the mini tablet has changed. Parameters
|
mountedChanged(
)
Returns: Signal |
---|
Triggered when the Example
|
shouldShowHandControllersChanged(
)
Returns: Signal |
---|
Triggered when a request to show or hide models of the HMD hand controllers is made using requestShowHandControllers or requestHideHandControllers. Example
|
showTabletChanged(
showTablet
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when the tablet is shown or hidden. Parameters
|