files/en-us/web/api/hmdvrdevice/geteyeparameters/index.md
{{deprecated_header}}{{APIRef("WebVR API")}}{{Non-standard_header}}
The getEyeParameters() method of the {{domxref("HMDVRDevice")}} interface returns current parameters for the eye specified as its argument ("left" or "right") — stored in a {{domxref("VREyeParameters")}} object.
This includes field of view information, and more.
getEyeParameters(whichEye)
whichEye
left or right.A {{domxref("VREyeParameters")}} object.
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) {
const eyeParamsL = vrHMD.getEyeParameters("left");
const eyeParamsR = vrHMD.getEyeParameters("right");
eyeTranslationL = eyeParamsL.eyeTranslation;
eyeTranslationR = eyeParamsR.eyeTranslation;
eyeFOVL = eyeParamsL.recommendedFieldOfView;
eyeFOVR = eyeParamsR.recommendedFieldOfView;
} else {
// …
}
{{Compat}}