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
shorthand to query the right controller. Use controllers to get access to all connected controllers
get the XR rig worldscale
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
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
Remove a rig from the available XR Rigs
Sets a XRRig to be active which will parent the camera to this rig
Staticgeta new XRSession init object with defaults
StaticgetXRSyncStaticisARSupportedStaticisStaticisVRSupportedStaticisXRSupportedStaticoffUnsubscribe from controller added evts
StaticoffUnsubscribe from controller removed events
StaticofferIf the browser supports offerSession - creating a VR or AR button in the browser navigation bar
StaticoffStaticoffStaticoffXRSessionStaticoffXRSessionStaticonListen 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
StaticonStaticonStaticonXRSessionStaticonXRSessionStaticsetStaticstartstart 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
Staticstop
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