Search e01
One query across the encyclopedia, books, dictionary, papers, Wikidata and the developer library. Every hit carries its source.
6 results across 6 corpora for XRFrame.
Developer library 6
XRAnchor
ng a session with anchors enabled ```js navigator.xr.requestSession("immersive-ar", { requireFeatures: ["anchors"], }); ``` ### Adding anchors You can use XRFrame.createAnchor() to create an anchor. ```js frame.createAnchor(anchorPose, referenceSpace).then( (anchor) => { // Do stuff with the anchor (assign objects that will be relative to this anchor) }, (error) => { console.error(`Could not creat
XRAnchor: anchorSpace property
ly **`anchorSpace`** property of the XRAnchor interface returns an XRSpace object to locate the anchor relative to other `XRSpace` objects. It can be passed to XRFrame.getPose() subsequently. ## Value An XRSpace object. ## Examples ### Updating anchors ```js for (const anchor of frame.trackedAnchors) { const pose = frame.getPose(anchor.anchorSpace, referenceSpace); } ``` ## Specifications ## Browser compat
XRHitTestResult
XR Device API](/docs/Web/API/WebXR_Device_API) contains a single result of a hit test. You can get an array of `XRHitTestResult` objects for a frame by calling XRFrame.getHitTestResults(). ## Instance properties None. ## Instance methods - XRHitTestResult.createAnchor() - : Returns a Promise that resolves with an XRAnchor created from the hit test result. - XRHitTestResult.getPose() - : Returns the XRPose o
XRHitTestResult: getPose() method
Examples ### Getting the hit test result's pose The following example uses `getPose()` to query a single hit test result's pose. ```js let hitTestResults = xrFrame.getHitTestResults(hitTestSource); if (hitTestResults.length > 0) { let pose = hitTestResults[0].getPose(referenceSpace); } ``` ## Specifications ## Browser compatibility ## See also - XRFrame.getPose()
XRHitTestResult: createAnchor() method
with an XRAnchor object. ## Examples ### Creating an anchor from a hit test result The following example starts with an XRHitTestResult retrieved by calling XRFrame.getHitTestResults(). After calling `createAnchor()`, the Promise resolves with an XRAnchor to attach a virtual object to that location. ```js hitTestResult.createAnchor().then( (anchor) => { // add anchored objects to the scene }, (error) =>
XRViewport
erates over each of the views within the viewer's pose, configuring the viewport as dictated by the XRWebGLLayer. ```js xrSession.requestAnimationFrame((time, xrFrame) => { const viewerPose = xrFrame.getViewerPose(xrReferenceSpace); gl.bindFramebuffer(xrWebGLLayer.framebuffer); for (const xrView of viewerPose.views) { const xrViewport = xrWebGLLayer.getViewport(xrView); gl.viewport( xrViewport.