ReadonlycontextThe needle engine context this session was started from
ReadonlycontrollersThe currently active/connected controllers
ReadonlymodeXR Session Mode: AR or VR
ReadonlysessionThe current XR frame
The XRSession interface's read-only interactionMode property describes the best space (according to the user agent) for the application to draw an interactive UI for the current session.
Returns true if running in pass through mode in immersive AR (e.g. user is wearing a headset while in AR)
If the AR mode is not immersive (meaning the user is e.g. holding a phone instead of wearing a AR passthrough headset)
Check if the session has system keyboard support
returns true if images are currently being tracked
Check if the session is visible-blurred - this means e.g. the keyboard is shown
shorthand to query the left controller. Use controllers to get access to all connected controllers
the context.renderer.xr.getReferenceSpace() result
The currently active XR rig
shorthand to query the right controller. Use controllers to get access to all connected controllers
Get the XR Rig worldscale.
For AR
If you want to modify the scale in AR at runtime get the WebARSessionRoot component via findObjectOfType(WebARSessionRoot) and then set the arScale value.
Returns true if the xr session is still active
the XRFrame viewerpose using the xr referenceSpace
The visibility state of the XRSession
Staticactivethe active
StaticactiveThe active xr session mode (if any xr session is active)
StaticcurrentStaticxrXRSystem via navigator.xr access
add a rig to the available XR rigs - if it's priority is higher than the currently active rig it will be enabled
convert a XRRigidTransform from XR session space to threejs / Needle Engine XR space
End the XR Session
Call to fade rendering to black for a short moment (the returned promise will be resolved when fully black)
This can be used to mask scene transitions or teleportation
a promise that is resolved when the screen is fully black
the given controller if it is connected
Returns a XR hit test result (if hit-testing is available) in rig space
Optionalsource: NeedleXRControllerIf provided, the hit test will be performed for the given controller
the user position in the rig space
Sets a XRRig to be active which will parent the camera to this rig
Staticgeta new XRSession init object with defaults
StaticgetXRSyncStaticisARSupportedtrue if the browser supports immersive-ar (WebXR)
StaticisThe XRSessionMode to check if it is supported
true if the browser supports the given XRSessionMode
StaticisVRSupportedtrue if the browser supports immersive-vr (WebXR)
StaticisXRSupportedtrue if the browser supports WebXR (immersive-vr or immersive-ar)
StaticoffStaticoffStaticofferIf the browser supports offerSession - creating a VR or AR button in the browser navigation bar
StaticoffUnsubscribe from request end evt
StaticoffUnsubscribe from request start evt. Register with onSessionRequestStart
StaticoffXRSessionUnsubscribe from XRSession started events
StaticoffXRSessionUnsubscribe from XRSession started events
StaticonListen to controller added events. Events are cleared when starting a new session
StaticonListen to controller removed events Events are cleared when starting a new session
StaticonCalled after the session request has finished
StaticonRegister to listen to XRSession start events. Unsubscribe with offXRSessionStart
StaticonXRSessionListen to XR session ended. Unsubscribe with offXRSessionEnd
StaticonXRSessionListen to XR session started. Unsubscribe with offXRSessionStart
StaticsetStaticstartstart a new webXR session (make sure to stop already running sessions before calling this method)
The XRSessionMode to start (e.g. immersive-vr or immersive-ar) or ar to start immersive-ar on supported devices OR on iOS devices it will export an interactive USDZ and open in Quicklook.
Get more information about WebXR modes: https://developer.mozilla.org/en-US/docs/Web/API/XRSessionMode
Optionalinit: XRSessionInitThe XRSessionInit to use (optional), docs: https://developer.mozilla.org/en-US/docs/Web/API/XRSessionInit
Optionalcontext: ContextThe Needle Engine context to use
Staticstopstops the active XR session
This class manages an XRSession to provide helper methods and events. It provides easy access to the XRInputSources (controllers and hands)
NeedleXRSession.start(...)NeedleXRSession.stop()NeedleXRSession.activeIf a XRSession is active you can use all XR-related event methods on your components to receive XR events e.g.
onEnterXR,onUpdateXR,onLeaveXRXRRig
The XRRig can be accessed via the
rigpropertySet a custom XRRig via
NeedleXRSession.addRig(...)orNeedleXRSession.removeRig(...)By default the active XRRig with the highest priority in the scene is used