VrHeadModel #

VrHeadModel is a util module that simplifies obtaining the current orientation of the headset

As React VR code runs asynchronously from the main render thread the data obtained will be laggy so the data should not be expected to be fully in sync with display

Methods #

constructor() #

positionOfHeadMatrix(headMatrix) #

Return position of the head as [X,Y,Z].

If headMatrix is not specified the current orientation of the headset is used.

rotationOfHeadMatrix(headMatrix, eulerOrder) #

Return rotation as Euler angles in radians.

If headMatrix is not specified the current orientation of the headset is used. If eulerOrder is not specified YXZ order is used, i.e. [Yaw, Pitch, Roll].

position() #

Return position of the head as [X,Y,Z].

rotation() #

Return rotation as Euler angles in degrees.

Returns an array in the form: [rotation about X axis, rotation about Y axis, rotation about Z axis]

rotationInRadians() #

Return rotation as Euler angles in degrees.

Returns an array in the form: [rotation about X axis, rotation about Y axis, rotation about Z axis]

yawPitchRoll() #

Return the rotation in yaw, pitch, roll order in degrees.

For those new to 3D graphics and who are not former pilots Yaw = looking up and down Pitch = looking to the left and right Roll = tilting your head from side to side

Returns an array of rotations in the form: [Y axis, X axis, Z axis]

yawPitchRollInRadians() #

Return the rotation in yaw, pitch, roll order in radians.

For those new to 3D graphics and are not former pilots Yaw = looking up and down Pitch = looking to the left and right Roll = tilting your head from side to side

Returns an array of rotations in the form: [Y axis, X axis, Z axis]

horizontalFov() #

Return the horizontal field of view of the camera in degrees.

verticalFov() #

Return the vertical field of view of the camera in degrees.

horizontalFovInRadians() #

Return the horizontal field of view of the camera in radians.

verticalFovInRadians() #

Return the vertical field of view of the camera in radians.

getHeadMatrix() #

Return Head matrix as array of numbers

getVRStatus() #

Return true if the headset is currently used

inVR() #

Return true if using a VR headset, false if viewing outside of VR

You can file an issue on GitHub if you see a typo or error on this page!