Class: HUD

HUD(camera)

HUD stands for head-up display - a UI container mounted on users head. Typically we have some buttons around 50 cm front, 10-20 cm below line of sight. This is common UI supposed to be usefull on VR devices, PC and mobiles, but likely to be suboptimal - UI specifically designed for a device should be more ergonomic. By default it tracks active camera, and binds to new camera whenever active camera changes, e.g. upon entering/exiting VR. Constructed with a camera parameter, it does not rebound to a new one, e.g. switching from first-person view to god mode activates a different HUD.

Constructor

new HUD(camera)

Parameters:
Name Type Description
camera to track, by default tracks active camera
Source:

Classes

HUD

Methods

addButton()

Create a button with given text and image and add it to the HUD
Source:
Returns:
a BabylonJS HolographicButton

rescaleHUD()

Window.resize event handler, rescales the HUD if aspect ratio is too small for all buttons to fit.
Source:

showButtons(boolean)

Show or hide all HUD elements (buttons)
Parameters:
Name Type Description
boolean show or hide
Source:

trackCamera()

Handles camera change events, typically while entering/exiting VR.
Source: