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)
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
Static
activethe active
Static
activeThe active xr session mode (if any xr session is active)
Static
currentStatic
xrXRSystem 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
Optional
source: 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
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
offerIf the browser supports offerSession - creating a VR or AR button in the browser navigation bar
Static
offStatic
offStatic
offXRSessionStatic
offXRSessionStatic
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
) 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
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
stop
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.active
If a XRSession is active you can use all XR-related event methods on your components to receive XR events e.g.
onEnterXR
,onUpdateXR
,onLeaveXR
XRRig
The XRRig can be accessed via the
rig
propertySet a custom XRRig via
NeedleXRSession.addRig(...)
orNeedleXRSession.removeRig(...)
By default the active XRRig with the highest priority in the scene is used