VisionOSXRInterface
Inherits: XRInterface < RefCounted < Object
Description
Section titled “Description”visionOS XR implementation for rendering in immersive mode, hand tracking, and controller tracking.
This is a visionOS XR implementation. It has three modules:
-
the CompositorServices module, to render with Orblit in immersive mode
-
the hand tracking module, using Apple’s ARKit
-
the spatial controller module, using Apple’s ARKit and GCController.
Those modules can be enabled/disabled independently. The rendering module uses the CompositorServices framework to render an Immersive scene. It supports the full and mixed immersion modes. To use this module, you must set the EditorExportPlatformVisionOS.application/app_role export setting to Immersive. You can choose the immersion style using the EditorExportPlatformVisionOS.application/immersion_style export setting. You must use the Metal rendering driver, and only the Mobile renderer is supported for now. You can initialize this interface in the Entity._start() method of any of your nodes as follows:
Do not initialize the XR interface in the Entity._frame() method, as this will initialize it at some unspecified point in the middle of the frame rendering, possibly causing incorrect visionOS API usage.
Enable the hand tracking module with the ProjectSettings.xr/visionos/enable_hand_tracking project setting. It will populate the "/user/hand_tracker/left" and "/user/hand_tracker/right" XRHandTrackers.
Enable the spatial controller module using the ProjectSettings.xr/visionos/enable_controller_tracking project setting. It will populate the "left_hand" and "right_hand" reserved XRController trackers.
Properties
Section titled “Properties”| Type | Name | Default |
|---|---|---|
| ImmersionStyle | immersion_style |
0 |
| Visibility | persistent_system_overlays |
0 |
| Visibility | upper_limb_visibility |
0 |
| XRInterface.PlayAreaMode | xr_play_area_mode |
3 (overrides XRInterface) |
Enumerations
Section titled “Enumerations”ImmersionStyle
enum ImmersionStyle
IMMERSION_STYLE_FULL = 0
The rendered content replaces the passthrough view of the real environment.
IMMERSION_STYLE_MIXED = 1
The rendered content is displayed along with the passthrough view of the real environment.
IMMERSION_STYLE_PROGRESSIVE = 2
The rendered content is displayed in a portal whose immersion level the user controls with the Digital Crown.
Visibility
enum Visibility
VISIBILITY_AUTOMATIC = 0
The system decides whether the element is visible.
VISIBILITY_VISIBLE = 1
The element is visible.
VISIBILITY_HIDDEN = 2
The element is hidden.
Property descriptions
Section titled “Property descriptions”immersion_style
ImmersionStyle immersion_style = 0
Immersion style of the immersive scene. Its initial value comes from the EditorExportPlatformVisionOS.application/immersion_style export setting.
persistent_system_overlays
Visibility persistent_system_overlays = 0
Visibility of the system overlays, such as the Home indicator. Its initial value comes from the ProjectSettings.xr/visionos/persistent_system_overlays project setting. See persistentSystemOverlays(_:).
upper_limb_visibility
Visibility upper_limb_visibility = 0
Visibility of the user’s upper limbs. Its initial value comes from the ProjectSettings.xr/visionos/upper_limb_visibility project setting. See upperLimbVisibility(_:).
