HMDVRDevice.getEyeParameters()
Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The getEyeParameters()
method of the HMDVRDevice
interface returns current parameters for the eye specified as its argument ("left" or "right") — stored in a VREyeParameters
object.
This includes field of view information, and more.
Syntax
var myLeftEye = HMDVRDevice.getEyeParameters('left');
Parameters
whichEye
-
A
DOMString
representing the eye you want to return information about. The value can beleft
orright
.
Returns
A VREyeParameters
object.
Examples
The following example is taken from the Mozilla VR Team's threejs-vr-boilerplate code — to be precise, the VREffect.js file. Early on in the code the getEyeParameters()
method is used to access information about each eye, which is then used for rendering calculations later on.
if ( vrHMD.getEyeParameters !== undefined ) {
var eyeParamsL = vrHMD.getEyeParameters( 'left' );
var eyeParamsR = vrHMD.getEyeParameters( 'right' );
eyeTranslationL = eyeParamsL.eyeTranslation;
eyeTranslationR = eyeParamsR.eyeTranslation;
eyeFOVL = eyeParamsL.recommendedFieldOfView;
eyeFOVR = eyeParamsR.recommendedFieldOfView;
} else {
...
}
Browser compatibility
BCD tables only load in the browser
See also
- WebVR API homepage.
- https://mixedreality.mozilla.org/ — demos, downloads, and other resources from the Mozilla VR team.