Skip to content
0.2.0-dev Download ZIP
59 lines ·4.6 KB Raw
1<?xml version="1.0" encoding="UTF-8" ?>
2<class name="VisionOSXRInterface" inherits="XRInterface" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
3 <brief_description>
4 visionOS XR implementation for rendering in immersive mode, hand tracking, and controller tracking.
5 </brief_description>
6 <description>
7 This is a visionOS XR implementation. It has three modules:
8 - the CompositorServices module, to render with Godot in immersive mode
9 - the hand tracking module, using Apple's ARKit
10 - the spatial controller module, using Apple's ARKit and GCController.
11 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:
12 [codeblock]
13 func _ready() -> void:
14 var interface = XRServer.find_interface("visionOS")
15 if interface and interface.initialize():
16 var viewport : Viewport = get_viewport()
17 viewport.use_xr = true
18 viewport.vrs_mode = Viewport.VRS_XR
19 viewport.use_hdr_2d = true
20 [/codeblock]
21 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.
22 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.
23 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.
24 </description>
25 <tutorials>
26 </tutorials>
27 <members>
28 <member name="immersion_style" type="int" setter="set_immersion_style" getter="get_immersion_style" enum="VisionOSXRInterface.ImmersionStyle" default="0">
29 Immersion style of the immersive scene. Its initial value comes from the [member EditorExportPlatformVisionOS.application/immersion_style] export setting.
30 </member>
31 <member name="persistent_system_overlays" type="int" setter="set_persistent_system_overlays" getter="get_persistent_system_overlays" enum="VisionOSXRInterface.Visibility" default="0">
32 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].
33 </member>
34 <member name="upper_limb_visibility" type="int" setter="set_upper_limb_visibility" getter="get_upper_limb_visibility" enum="VisionOSXRInterface.Visibility" default="0">
35 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].
36 </member>
37 <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" />
38 </members>
39 <constants>
40 <constant name="IMMERSION_STYLE_FULL" value="0" enum="ImmersionStyle">
41 The rendered content replaces the passthrough view of the real environment.
42 </constant>
43 <constant name="IMMERSION_STYLE_MIXED" value="1" enum="ImmersionStyle">
44 The rendered content is displayed along with the passthrough view of the real environment.
45 </constant>
46 <constant name="IMMERSION_STYLE_PROGRESSIVE" value="2" enum="ImmersionStyle">
47 The rendered content is displayed in a portal whose immersion level the user controls with the Digital Crown.
48 </constant>
49 <constant name="VISIBILITY_AUTOMATIC" value="0" enum="Visibility">
50 The system decides whether the element is visible.
51 </constant>
52 <constant name="VISIBILITY_VISIBLE" value="1" enum="Visibility">
53 The element is visible.
54 </constant>
55 <constant name="VISIBILITY_HIDDEN" value="2" enum="Visibility">
56 The element is hidden.
57 </constant>
58 </constants>
59</class>