The getViewerPose()
method, a member of the XRFrame
interface, returns a XRViewerPose
object which describes the viewer's pose (position and orientation) relative to the specified reference space.
See the getPose()
method for a way to calculate a pose that represents the difference between two spaces.
getViewerPose(referenceSpace)
A XRViewerPose
describing the viewer's position and orientation relative to the specified reference space.
In this callback function for requestAnimationFrame()
, the XRViewerPose
describing the viewer's viewpoint on the world is obtained by calling getViewerPose()
on the XRFrame
passed into the callback.
viewerPose = xrFrame.getViewerPose(xrReferenceSpace);
if (viewerPose) {
}
To see a complete example, take a look at Movement, orientation, and motion.