HMDVRDevice: getEyeParameters() method
Deprecated
Avoid using this feature in new projects. This feature may be a candidate for removal from web standards or browsers.>
Non-standard: This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists.
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
getEyeParameters(whichEye)
Parameters
whichEye-
A string representing the eye you want to return information about. The value can be
leftorright.
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.
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 {
// …
}