WebXRSessionManager

Manages an XRSession to work with Babylon's engine

see

https://doc.babylonjs.com/how_to/webxr

Hierarchy

  • WebXRSessionManager

Implements

Index

Constructors

constructor

Find examples in Playground
  • 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

currentFrame

Find examples in Playground
currentFrame: Nullable<XRFrame>

Current XR frame

onXRFrameObservable

Find examples in Playground
onXRFrameObservable: Observable<XRFrame>

Fires every time a new xrFrame arrives which can be used to update the camera

onXRSessionEnded

Find examples in Playground
onXRSessionEnded: Observable<any>

Fires when the xr session is ended either by the device or manually done

onXRSessionInit

Find examples in Playground
onXRSessionInit: Observable<XRSession>

Fires when the xr session is ended either by the device or manually done

referenceSpace

Find examples in Playground
referenceSpace: XRReferenceSpace

Type of reference space used when creating the session

scene

Find examples in Playground
scene: Scene

The scene which the session should be created for

session

Find examples in Playground
session: XRSession

Underlying xr session

Methods

dispose

Find examples in Playground
  • dispose(): void

exitXRAsync

Find examples in Playground
  • exitXRAsync(): Promise<void>
  • Stops the xrSession and restores the renderloop

    Returns Promise<void>

    Promise which resolves after it exits XR

getRenderTargetTextureForEye

Find examples in Playground
  • 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

getWebXRRenderTarget

Find examples in Playground
  • Creates a WebXRRenderTarget object for the XR session

    Parameters

    Returns WebXRRenderTarget

    a WebXR render target to which the session can render

initializeAsync

Find examples in Playground
  • initializeAsync(): Promise<void>
  • Initializes the manager After initialization enterXR can be called to start an XR session

    Returns Promise<void>

    Promise which resolves after it is initialized

initializeSessionAsync

Find examples in Playground
  • Initializes an xr session

    Parameters

    • xrSessionMode: XRSessionMode

      mode to initialize

    • Optional optionalFeatures: any

      defines optional values to pass to the session builder

    Returns Promise<XRSession>

    a promise which will resolve once the session has been initialized

setReferenceSpaceAsync

Find examples in Playground
  • Sets the reference space on the xr session

    Parameters

    Returns Promise<void>

    a promise that will resolve once the reference space has been set

startRenderingToXRAsync

Find examples in Playground
  • startRenderingToXRAsync(): Promise<void>
  • Starts rendering to the xr layer

    Returns Promise<void>

    a promise that will resolve once rendering has started

supportsSessionAsync

Find examples in Playground
  • supportsSessionAsync(sessionMode: XRSessionMode): Promise<boolean>
  • 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>

    true if supported

updateRenderStateAsync

Find examples in Playground
  • Updates the render state of the session

    Parameters

    Returns Promise<void>

    a promise that resolves once the render state has been updated

Static IsSessionSupportedAsync

Find examples in Playground
  • IsSessionSupportedAsync(sessionMode: XRSessionMode): Promise<boolean>
  • Gets a promise returning true when fullfiled if the given session mode is supported

    Parameters

    Returns Promise<boolean>

    a promise

Generated using TypeDoc