Readonly contextThe needle engine context this session was started from
Readonly controllersThe currently active/connected controllers
Readonly modeXR Session Mode: AR or VR
Readonly sessionThe 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)
returns true if images are currently being tracked
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
get the XR rig worldscale
shorthand to query the right controller. Use controllers to get access to all connected controllers
Returns true if the xr session is still active
the XRFrame viewerpose using the xr referenceSpace
The visibility state of the XRSession
Static activeStatic activeThe active xr session mode (if any xr session is active)
Static currentStatic xrXRSystem via navigator.xr access
convert a XRRigidTransform from XR session space to threejs / Needle Engine XR space
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
`fadeTransition().then(() => { <fully_black> })`
the given controller if it is connected
Returns a XR hit test result (if hit-testing is available) in rig space
Optional source: NeedleXRControllerIf provided, the hit test will be performed for the given controller
Static geta new XRSession init object with defaults
Static getXRSyncStatic isARSupportedStatic isStatic isVRSupportedStatic isXRSupportedStatic offUnsubscribe from controller added evts
Static offUnsubscribe from controller removed events
Static offStatic offStatic offXRSessionStatic offXRSessionStatic offerIf the browser supports offerSession - creating a VR or AR button in the browser navigation bar
Static onListen to controller added events. Events are cleared when starting a new session
Static onListen to controller removed events Events are cleared when starting a new session
Static onStatic onStatic onXRSessionStatic onXRSessionStatic setStatic startstart 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), docs: https://developer.mozilla.org/en-US/docs/Web/API/XRSessionMode
Optional init: XRSessionInitThe XRSessionInit to use (optional), docs: https://developer.mozilla.org/en-US/docs/Web/API/XRSessionInit
Optional context: ContextThe Needle Engine context to use
Static stopGenerated using TypeDoc
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