Module: hmd

Head Mounted Devices add-on. Provides support for HMD/VR devices using WebVR API.

For more info about stereo rendering check out the user manual.

Summary

Members

Methods

Type Definitions

Detailed Description

Members

HMD_ALL_AXES_MOUSE_NONE

HMD behavior: HMD controls camera rotation, mouse does not affect camera orientation.
Type:
  • HMDBehavior
Source:

HMD_ALL_AXES_MOUSE_YAW

HMD behavior: HMD affects camera rotation, mouse affect yaw rotation.
Type:
  • HMDBehavior
Source:

HMD_NONE_MOUSE_ALL_AXES

HMD behavior: HMD does not affect camera orientation, mouse controls camera rotation.
Type:
  • HMDBehavior
Source:

HMD_ROLL_PITCH_MOUSE_YAW

HMD behavior: HMD controls roll and pitch rotation, mouse controls yaw rotation.
Type:
  • HMDBehavior
Source:

Methods

check_browser_support() → {boolean}

Check if the browser supports WebVR API or it is a mobile version of the browser.
Returns:
Checking result.
Type
boolean
Source:

disable_controllers()

Disable VR controllers.
Source:
Example
var m_hmd = require("hmd");

m_hmd.disable_controllers();

disable_hmd()

Disable HMD.
Source:

enable_controllers(gamepad_1opt, gamepad_2opt)

Enable VR controllers.
Parameters:
Name Type Attributes Description
gamepad_1 Object3D <optional>
Object presenting controller.
gamepad_2 Object3D <optional>
Object presenting controller.
Source:
Example
var m_hmd = require("hmd");
var m_scenes = require("scenes");

var gamepad_1 = m_scenes.get_object_by_name("my_gamepad_1");
var gamepad_2 = m_scenes.get_object_by_name("my_gamepad_2");
m_hmd.enable_controllers(gamepad_1, gamepad_2);

enable_hmd(control_type)

Enable HMD.
Parameters:
Name Type Description
control_type HMDBehavior Camera rotation type.
Source:

get_position(dest) → {Vec3}

Get hmd initial position.
Parameters:
Name Type Description
dest Vec3 Initial position.
Returns:
dest.
Type
Vec3
Source:
Example
var m_hmd = require("hmd");
var m_vec3 = require("vec3");
var _vec3_tmp = m_vec3.create();

var pos = m_hmd.get_position(_vec3_tmp);

get_rotate_quat(dest) → {Quat}

Get hmd initial rotation quat.
Parameters:
Name Type Description
dest Quat Initial rotation quaternion.
Returns:
dest.
Type
Quat
Source:
Example
var m_hmd = require("hmd");
var m_quat = require("quat");
var _quat_tmp = m_quat.create();

var quat = m_hmd.get_rotate_quat(_quat_tmp);

set_position(position)

Set hmd initial position.
Parameters:
Name Type Description
position Vec3 Initial position.
Source:
Example
var m_hmd = require("hmd");

m_hmd.set_position([0,0,0]);

set_rotate_quat(quat)

Set hmd initial rotation quat.
Parameters:
Name Type Description
quat Quat Initial rotation quaternion.
Source:
Example
var m_hmd = require("hmd");

m_hmd.set_rotate_quat([0,0,0,1]);

Type Definitions