HMDVRDevice: getEyeParameters() method

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.

Non-standard: This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

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

js
getEyeParameters(whichEye)

Parameters

whichEye

A string representing the eye you want to return information about. The value can be left or right.

Return value

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.

js
if (vrHMD.getEyeParameters !== undefined) {
  const eyeParamsL = vrHMD.getEyeParameters("left");
  const 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