Godot Engine – Multi-platform 2D and 3D game engine
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisionOSXRInterface" inherits="XRInterface" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description>
visionOS XR implementation for rendering in immersive mode, hand tracking, and controller tracking.
</brief_description>
<description>
This is a visionOS XR implementation. It has three modules:
- the CompositorServices module, to render with Godot 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 [member EditorExportPlatformVisionOS.application/app_role] export setting to [code]Immersive[/code]. You can choose the immersion style using the [member 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 [method Node._ready] method of any of your nodes as follows:
[codeblock]
func _ready() -> void:
var interface = XRServer.find_interface("visionOS")
if interface and interface.initialize():
var viewport : Viewport = get_viewport()
viewport.use_xr = true
viewport.vrs_mode = Viewport.VRS_XR
viewport.use_hdr_2d = true
[/codeblock]
Do not initialize the XR interface in the [method Node._process] 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 [member ProjectSettings.xr/visionos/enable_hand_tracking] project setting. It will populate the [code]"/user/hand_tracker/left"[/code] and [code]"/user/hand_tracker/right"[/code] XRHandTrackers.
Enable the spatial controller module using the [member ProjectSettings.xr/visionos/enable_controller_tracking] project setting. It will populate the [code]"left_hand"[/code] and [code]"right_hand"[/code] reserved XRController trackers.
</description>
<tutorials>
</tutorials>
<members>
<member name="immersion_style" type="int" setter="set_immersion_style" getter="get_immersion_style" enum="VisionOSXRInterface.ImmersionStyle" default="0">
Immersion style of the immersive scene. Its initial value comes from the [member EditorExportPlatformVisionOS.application/immersion_style] export setting.
</member>
<member name="persistent_system_overlays" type="int" setter="set_persistent_system_overlays" getter="get_persistent_system_overlays" enum="VisionOSXRInterface.Visibility" default="0">
Visibility of the system overlays, such as the Home indicator. Its initial value comes from the [member ProjectSettings.xr/visionos/persistent_system_overlays] project setting. See [url=https://developer.apple.com/documentation/swiftui/view/persistentsystemoverlays(_:)]persistentSystemOverlays(_:)[/url].
</member>
<member name="upper_limb_visibility" type="int" setter="set_upper_limb_visibility" getter="get_upper_limb_visibility" enum="VisionOSXRInterface.Visibility" default="0">
Visibility of the user's upper limbs. Its initial value comes from the [member ProjectSettings.xr/visionos/upper_limb_visibility] project setting. See [url=https://developer.apple.com/documentation/swiftui/scene/upperlimbvisibility(_:)]upperLimbVisibility(_:)[/url].
</member>
<member name="xr_play_area_mode" type="int" setter="set_play_area_mode" getter="get_play_area_mode" overrides="XRInterface" enum="XRInterface.PlayAreaMode" default="3" />
</members>
<constants>
<constant name="IMMERSION_STYLE_FULL" value="0" enum="ImmersionStyle">
The rendered content replaces the passthrough view of the real environment.
</constant>
<constant name="IMMERSION_STYLE_MIXED" value="1" enum="ImmersionStyle">
The rendered content is displayed along with the passthrough view of the real environment.
</constant>
<constant name="IMMERSION_STYLE_PROGRESSIVE" value="2" enum="ImmersionStyle">
The rendered content is displayed in a portal whose immersion level the user controls with the Digital Crown.
</constant>
<constant name="VISIBILITY_AUTOMATIC" value="0" enum="Visibility">
The system decides whether the element is visible.
</constant>
<constant name="VISIBILITY_VISIBLE" value="1" enum="Visibility">
The element is visible.
</constant>
<constant name="VISIBILITY_HIDDEN" value="2" enum="Visibility">
The element is hidden.
</constant>
</constants>
</class>