Dies ist eine experimentelle Technologie
Da diese Technologie noch nicht definitiv implementiert wurde, sollte die Browserkompatibilität beachtet werden. Es ist auch möglich, dass die Syntax in einer späteren Spezifikation noch geändert wird.
WebVR provides support for exposing virtual reality devices — for example head-mounted displays like the Oculus Rift — to web apps, enabling developers to translate position and movement information from the display into movement around a 3D scene. This has numerous very interesting applications, from virtual product tours and interactive training apps to super immersive first person games.
Concepts and usage
Any VR devices attached to your computer will be returned by the
Navigator.getVRDevices() method. This returns an array of objects to represent the attached devices, which inherit from the general
VRDevice object — generally a head mounted display will have two devices — the head mounted display itself, represented by
HMDVRDevice, and a position sensor camera that keeps track of your head position, represented by
PositionSensorVRDevice object contains the
getState() method, which returns a
VRPositionState object — this represents the sensor’s state at a given timestamp, and includes properties containing useful data such as current velocity, acceleration, and orientation, useful for updating the rendering of a scene on each frame according to the movement of the VR head mounted display.
HMDVRDevice.getEyeParameters() method returns a
VREyeParameters object, which can be used to return field of view information — how much of the scene the head mounted display can see. The
VREyeParameters.currentFieldOfView returns a
VRFieldOfView object that contains 4 angles describing the current view from a center point. You can also change the field of view using
- Returns a promise that resolves to an array of objects representing the VR devices attached to the computer.
- A generic VR device, includes information such as device IDs and descriptions. Inherited by
- Represents a head mounted display, providing access to information about each eye, and the current field of view.
- Represents the position sensor for the VR hardware, allowing access to information such as position and orientation.
- Represents the position state at a given timestamp (which includes orientation, position, velocity, and acceleration.)
- Provides access to all the information required to correctly render a scene for each given eye, including field of view information.
- Represents a field of view defined by 4 different degree values describing the view from a center point.
- Contains the raw definition for the degree value properties required to define a field of view. Inherited by
You can find a number of examples at these Github repos:
- mdn/webvr-tests: Simple demos built to illiustrate basic feature usage.
- MozVR team: More advanced demos, the WebVR spec source, and more!
|Feature||Chrome||Firefox (Gecko)||Internet Explorer||Opera||Safari (WebKit)|
|Basic support||Experimental support
disabled by default
|Feature||Android||Firefox Mobile (Gecko)||Firefox OS (Gecko)||IE Phone||Opera Mobile||Safari Mobile||Chrome for Android|
|Basic support||Nicht unterstützt||39.0 (39)
disabled by default
|Nicht unterstützt||Nicht unterstützt||Nicht unterstützt||Nicht unterstützt||Nicht unterstützt|
 To find information on Chrome's WebVR implementation status including supporting builds, check out Bringing VR to Chrome by Brandon Jones.
 To enable WebVR support in Firefox Nightly/Developer Edition, you can go to about:config and enable the
dom.vr* prefs. A better option however is to install the WebVR Enabler Add-on, which does this for you and sets up other necessary parts of the environment.
- WebVR environment setup
- WebVR concepts
- Using the WebVR API
- MozVr.com — demos, downloads, and other resources from the Mozilla VR team.
- Console Game on Web — a collection of interesting game concept demos, some of which include WebVR.
- threejs-vr-boilerplate — a very useful starter template for writing WebVR apps into.
- Oculus Rift homepage