Class WebXRSessionManager
Hierarchy
- WebXRSessionManager
Implements
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
-
Constructs a WebXRSessionManager, this must be initialized within a user action before usage
Parameters
-
scene: Scene
The scene which the session should be created for
Returns WebXRSessionManager
-
Properties
base Reference SpaceSearch playground for baseReferenceSpace
The base reference space from which the session started. good if you want to reset your reference space
current FrameSearch playground for currentFrame
Current XR frame
current TimestampSearch playground for currentTimestamp
WebXR timestamp updated every frame
default Height CompensationSearch playground for defaultHeightCompensation
Used just in case of a failure to initialize an immersive session. The viewer reference space is compensated using this height, creating a kind of "viewer-floor" reference space
onXRFrame ObservableSearch playground for onXRFrameObservable
Fires every time a new xrFrame arrives which can be used to update the camera
onXRReference Space ChangedSearch playground for onXRReferenceSpaceChanged
Fires when the reference space changed
onXRSession EndedSearch playground for onXRSessionEnded
Fires when the xr session is ended either by the device or manually done
onXRSession InitSearch playground for onXRSessionInit
Fires when the xr session is ended either by the device or manually done
sceneSearch playground for scene
The scene which the session should be created for
sessionSearch playground for session
Underlying xr session
viewer Reference SpaceSearch playground for viewerReferenceSpace
The viewer (head position) reference space. This can be used to get the XR world coordinates or get the offset the player is currently at.
Accessors
is Native
-
Returns true if Babylon.js is using the BabylonNative backend, otherwise false
Returns boolean
reference Space
-
The current reference space used in this session. This reference space can constantly change! It is mainly used to offset the camera's position.
Returns XRReferenceSpace
-
Set a new reference space and triggers the observable
Parameters
-
newReferenceSpace: XRReferenceSpace
Returns any
-
Methods
disposeSearch playground for dispose
-
Disposes of the session manager
Returns void
exitXRAsyncSearch playground for exitXRAsync
-
Stops the xrSession and restores the render loop
Returns Promise<void>
Promise which resolves after it exits XR
get Render Target Texture For EyeSearch playground for getRenderTargetTextureForEye
-
Gets the correct render target texture to be rendered this frame for this eye
Parameters
-
eye: XREye
the eye for which to get the render target
Returns RenderTargetTexture
the render target for the specified eye
-
get WebXRRender TargetSearch playground for getWebXRRenderTarget
-
Creates a WebXRRenderTarget object for the XR session
Parameters
-
Optional options: WebXRManagedOutputCanvasOptions
optional options to provide when creating a new render target
Returns WebXRRenderTarget
a WebXR render target to which the session can render
-
initialize AsyncSearch playground for initializeAsync
-
Initializes the manager After initialization enterXR can be called to start an XR session
Returns Promise<void>
Promise which resolves after it is initialized
initialize Session AsyncSearch playground for initializeSessionAsync
-
Initializes an xr session
Parameters
-
Optional xrSessionMode: XRSessionMode
mode to initialize
-
Optional xrSessionInit: XRSessionInit
defines optional and required values to pass to the session builder
Returns Promise<XRSession>
a promise which will resolve once the session has been initialized
-
is Session Supported AsyncSearch playground for isSessionSupportedAsync
-
Checks if a session would be supported for the creation options specified
Parameters
-
sessionMode: XRSessionMode
session mode to check if supported eg. immersive-vr
Returns Promise<boolean>
A Promise that resolves to true if supported and false if not
-
reset Reference SpaceSearch playground for resetReferenceSpace
-
Resets the reference space to the one started the session
Returns void
runXRRender LoopSearch playground for runXRRenderLoop
-
Starts rendering to the xr layer
Returns void
set Reference Space Type AsyncSearch playground for setReferenceSpaceTypeAsync
-
Sets the reference space on the xr session
Parameters
-
Optional referenceSpaceType: XRReferenceSpaceType
space to set
Returns Promise<XRReferenceSpace>
a promise that will resolve once the reference space has been set
-
update Render State AsyncSearch playground for updateRenderStateAsync
-
Updates the render state of the session
Parameters
-
state: XRRenderState
state to set
Returns Promise<void>
a promise that resolves once the render state has been updated
-
Static Is Session Supported AsyncSearch playground for IsSessionSupportedAsync
-
Returns a promise that resolves with a boolean indicating if the provided session mode is supported by this browser
Parameters
-
sessionMode: XRSessionMode
defines the session to test
Returns Promise<boolean>
a promise with boolean as final value
-
Manages an XRSession to work with Babylon's engine
https://doc.babylonjs.com/how_to/webxr_session_manager