WebXRSessionManager

Manages an XRSession

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

onXRFrameObservable

Find examples in Playground
onXRFrameObservable: Observable<any>

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

Methods

dispose

Find examples in Playground
  • dispose(): void

enterXRAsync

Find examples in Playground
  • Enters XR with the desired XR session options, this must be done with a user action (eg. button click event)

    Parameters

    • sessionCreationOptions: XRSessionCreationOptions

      xr options to create the session with

    • frameOfReferenceType: string

      option to configure how the xr pose is expressed

    Returns Promise<void>

    Promise which resolves after it enters XR

environmentPointHitTestAsync

Find examples in Playground
  • Fires a ray and returns the closest hit in the xr sessions enviornment, useful to place objects in AR

    Parameters

    • ray: Ray

      ray to cast into the environment

    Returns Promise<Nullable<Vector3>>

    Promise which resolves with a collision point in the environment if it exists

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

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

supportsSessionAsync

Find examples in Playground
  • Checks if a session would be supported for the creation options specified

    Parameters

    Returns Promise<boolean>

    true if supported

Generated using TypeDoc