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.
- Source:
Summary
Members
Methods
- check_browser_support() → {boolean}
- disable_controllers()
- disable_hmd()
- enable_controllers(gamepad_1opt, gamepad_2opt)
- enable_hmd(control_type)
- get_position(dest) → {Vec3}
- get_rotate_quat(dest) → {Quat}
- set_position(position)
- set_rotate_quat(quat)
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_rotate_quat(dest) → {Quat}
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
HMDBehavior
HMD behavior enum.
Type:
- number