A component that manages the settings for a WebXR session, including the ability to launch an XR session when the user taps on the Launch button for an experience. If you're building an experience from scratch, you may wish to use one of the XRRig components - they constitute a pre-defined setup that includes an instance of this component.

You can use this component to handle various events that may take place during the user experience, such as if the device loses its ability to track the user's environment. It also simulates pointers (i.e. click, pointerdown, pointerup) events for input sources (e.g. controllers and screen taps).

three/XRManager

settings

three/Object3D/Group/**

Hierarchy

  • Component
    • XRManager

Accessors

  • get disposed(): boolean
  • Gets the disposed status of the entity.

    Returns boolean

    The disposed status.

  • get elementsResolved(): any[]
  • An array of the elements that this component instance exposes. In the case that this component does not expose any elements of its own, this will be an array of the elements exposed by this component's children.

    Returns any[]

  • get lockedResolved(): boolean
  • Returns true if this component, or any of its parents, are marked as locked.

    Returns boolean

Constructors

Methods

  • Adds a behavior to the component.

    Parameters

    • b: Behavior<Component<any, ConstructorProps>>

      The behavior to add.

    Returns void

  • Adds the supplied component instance as a child of this component, removing it from any existing parent.

    Parameters

    • c: Component<any, ConstructorProps>

      The component instance to add

    Returns void

  • Constructs the children of this component.

    Parameters

    • children: ComponentChildren
    • OptionalcontextManager: ContextManager

    Returns void

  • Dispose of this component and all of its children.

    Returns never

  • Gets a behavior of a specific type from the component.

    Type Parameters

    • T extends (new (contextManager: ContextManager, instance: Component<any, ConstructorProps>, ...args: any[]) => Behavior<Component<any, ConstructorProps>>)

      The behavior type.

    Parameters

    • type: T

      The type of behavior to get.

    Returns undefined | InstanceType<T>

    The behavior of the specified type, or undefined if no such behavior exists.

  • Gets all behaviors of a specific type from the component.

    Type Parameters

    • T extends (new (contextManager: ContextManager, instance: Component<any, ConstructorProps>, ...args: any[]) => Behavior<Component<any, ConstructorProps>>)

      The behavior type.

    Parameters

    • type: T

      The type of behaviors to get.

    Returns InstanceType<T>[]

    An array of behaviors of the specified type.

  • Get the instance of the ZComponent that constructed this entity.

    If you pass the class of a ZComponent as the type parameter, this function will ensure that it returns an instance of that ZComponent. If this component or behavior was constructed by a different ZComponent class, or by a different entity altogether, the function with throw an error.

    Type Parameters

    • T extends ZComponent<any, T> = ZComponent<any>

    Parameters

    • Optionaltype: ConstructorForComponent<T>

      The ZComponent class that you are expecting to receive

    Returns T

    The instance of the ZComponent that constructed this component or behavior

  • Register a function to be called when an Event is fired, or an Observable's value changes. The function will only be bound to the underlying Event or Observable while this entity is enabled.

    Using this function, rather than attaching your handler directly to the Event or Observable, ensures your handler is automatically released when this entity is disposed.

    Type Parameters

    • Args extends any[]

    Parameters

    • evt: Event<Args>

      The Event or Observable to listen to

    • fn: ((...args: Args) => void)

      A function that will be called when the event fires, or the Observable value changes

        • (...args): void
        • Parameters

          Returns void

    • Optionalpriority: number

    Returns any

  • Type Parameters

    • Args extends any[]

    Parameters

    Returns any

  • Type Parameters

    • Type

    Parameters

    • observable: Observable<Type, never>
    • fn: ((v: Type) => void)
        • (v): void
        • Parameters

          Returns void

    • Optionalpriority: number

    Returns any

  • Type Parameters

    • Type

    Parameters

    Returns any

  • Removes this component from its parent component.

    Returns void

  • Removes a behavior from the component.

    Parameters

    • b: Behavior<Component<any, ConstructorProps>>

      The behavior to remove.

    Returns void

  • Removes the supplied component instance from the list of children.

    Parameters

    • c: Component<any, ConstructorProps>

      The component to remove

    Returns void

  • Unregisters a function that was previously registered to an Event or Observable.

    Type Parameters

    • Args extends any[]

    Parameters

    • evt: Event<Args>

      The Event or Observable

    • fn: ((...args: Args) => void)

      The function that was passed in the call to register

        • (...args): void
        • Parameters

          Returns void

    Returns any

  • Type Parameters

    • Type

    Parameters

    • observable: Observable<Type, never>
    • fn: ((v: Type) => void)
        • (v): void
        • Parameters

          Returns void

    Returns any

Other

tags: Observable<string[], never>

An array of string 'tags' assocated with this component.

The getComponentsByTag(mgr, tag) function can be used to get an array of components with the supplied tag.

By default, tags are scoped to the ZComponent instance that a component is constructed by. Tags that begin with global: are scoped to the experience as a whole.

0

Properties - Advanced

selectOnVisionProEmulation: Observable<boolean, never> = ...

5

true

Properties - Animation

notSessionActiveLayerClip: Observable<undefined | string, never> = ...

The ID of a layer clip to play when this device location is not in an immersive XR session.

10

false

layerclipids

notTrackingLayerClip: Observable<undefined | string, never> = ...

The ID of a layer clip to play when this device location is not being tracked by the hardware.

10

false

layerclipids

sessionActiveLayerClip: Observable<undefined | string, never> = ...

The ID of a layer clip to play when the device is in an immersive XR session.

10

false

layerclipids

trackingLayerClip: Observable<undefined | string, never> = ...

The ID of a layer clip to play when the device location is being tracked by the hardware.

10

false

layerclipids

Properties - Behavior

enabled: Observable<boolean, never>

If false, this entity and its children will no longer participate in the experience.

Note - to read this value, you may wish to use enabledResolved which will be false if this entity, or any of its parents, have enabled set to false.

The precise implications of enabled being false will vary between entities, but in general disabled entities:

  • should not emit any events,
  • should not take any action, e.g. navigate the user to a different page,
  • should not perform any network communication,
  • should not make changes to other behaviors or components in the experience,
  • should minimise any runtime performance cost (e.g. detach from any frame handlers).

true

10

Properties - Other

behaviors: Behavior<Component<any, ConstructorProps>>[]

The behaviors attached to this component.

children: Component<any, ConstructorProps>[]

The children of this component.

contextManager: ContextManager
element?: any

The raw element(s) that this component exposes

enabledResolved: Observable<boolean, never>

This will have value false if this entity, or any of its parents, have enabled set to false.

To change the enabled status of this entity, use the enabled property instead.

The precise implications of enabled being false will vary between entities, but in general disabled entities:

  • should not emit any events,
  • should not take any action, e.g. navigate the user to a different page,
  • should not perform any network communication,
  • should not make changes to other behaviors or components in the experience,
  • should minimise any runtime performance cost.

Disabled entities will typically remain visible (if they have a visible appearance).

isTracking: Observable<boolean, never> = ...

true if the device is currently able to track its location in space.

locked?: boolean

If true, this component can't be selected at design time in the 3D preview.

onDispose: Event<[]>

An event that is fired as the last act of this entity being destroyed.

onNotTracking: Event<[]> = ...
onSessionEnd: Event<[]> = ...
onSessionStart: Event<[]> = ...
onTracking: Event<[]> = ...
parent?: Component<any, ConstructorProps>

The parent of this component.

Properties - Pointer Emulation

enablePointerEmulation: Observable<boolean, never> = ...

If true (the default), this component will emulate pointers for the various input devices reported by the underlying hardware (e.g. controllers, hands, screen taps). This means that you can use common pointer events such as click, pointerdown, pointerup, etc, when building your experience.

30

true

fingerProximityPointerEmulation: Observable<boolean, never> = ...

If true (the default), pointer emulation will be enabled for the index fingers of any tracked hands. Theis allows users to tap on interactive elements by 'touching' with their finger in 3D space.

30

true

gazeInputPointerEmulation: Observable<boolean, never> = ...

30

true

handPointerEmulation: Observable<boolean, never> = ...

If true (the default), pointer emulation will be enabled for hands reported by devices that support hand tracking. For hands, the device exposes a 'target ray' direction that determines where the pointer is pointing, and (on most devices) a 'pinch' gesture between the fingers determines 'pointer down'/'pointer up'.

30

true

leftHandedPointerEmulation: Observable<boolean, never> = ...

If false, controllers or tracked hands labeled as for the left hand will be ignored for pointer emulation.

30

true

physicalControllerPointerEmulation: Observable<boolean, never> = ...

If true (the default), pointer emulation will be enabled for any physical controllers reported by the underling device. For these controllers, a ray coming out of the controller determines the direction that the pointer is pointing, and the 'trigger' button determines 'pointer down'/'pointer up'.

30

true

rightHandedPointerEmulation: Observable<boolean, never> = ...

If false, controllers or tracked hands labeled as for the right hand will be ignored for pointer emulation.

30

true

screenInputPointerEmulation: Observable<boolean, never> = ...

Some browsers and XR modes (such immersive-ar mode on Google Chrome for Android) are handheld, where the user has the ability to tap on the screen. In this mode, browsers do not emit the usual pointer events that they do for a normal web page (e.g. click, pointerup, pointerdown), instead they pass this information to the page as XR device inputs. If this property is true (the default), then this component will process inputs for 'screen' devices and emulate these common pointer events.

30

true

showPointerRay: Observable<boolean, never> = ...

If true, rays will be shown in the direction of emulated pointers - typically the controller's 'target ray space'.

20

true

unspecifiedHandedPointerEmulation: Observable<boolean, never> = ...

If false, controllers or tracked hands without a specified 'handedness' will be ignored for pointer emulation.

30

true

Properties - Pointer Emulation Haptics

pulseDurationOnClick: Observable<number, never> = ...

The duration (in milliseconds) of the haptic vibration when an emulated pointer 'clicks' on an interactive object.

25

50

time-milliseconds

pulseDurationOnPointerEnter: Observable<number, never> = ...

The duration (in milliseconds) of the haptic vibration when an emulated pointer enters an interactive object.

25

50

time-milliseconds

pulseIntensityOnClick: Observable<number, never> = ...

The intensity (between 0 and 1) of the haptic vibration when an emulated pointer 'clicks' on an interactive object.

25

0.5

pulseIntensityOnPointerEnter: Observable<number, never> = ...

The intensity (between 0 and 1) of the haptic vibration when an emulated pointer enters an interactive object.

25

0.5

vibrateOnClick: Observable<boolean, never> = ...

If true, controllers featuring haptic hardware will vibrate when the emulated pointer 'clicks' on an interactive object.

25

true

vibrateOnPointerEnter: Observable<boolean, never> = ...

If true, controllers featuring haptic hardware will vibrate when the emulated pointer enters an interactive object.

25

true