class_xrinterface.rst 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/XRInterface.xml.
  6. .. _class_XRInterface:
  7. XRInterface
  8. ===========
  9. **Inherits:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`MobileVRInterface<class_MobileVRInterface>`, :ref:`OpenXRInterface<class_OpenXRInterface>`, :ref:`WebXRInterface<class_WebXRInterface>`, :ref:`XRInterfaceExtension<class_XRInterfaceExtension>`
  11. Base class for an XR interface implementation.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. This class needs to be implemented to make an AR or VR platform available to Godot and these should be implemented as C++ modules or GDExtension modules. Part of the interface is exposed to GDScript so you can detect, enable and configure an AR or VR platform.
  16. Interfaces should be written in such a way that simply enabling them will give us a working setup. You can query the available interfaces through :ref:`XRServer<class_XRServer>`.
  17. .. rst-class:: classref-introduction-group
  18. Tutorials
  19. ---------
  20. - :doc:`XR documentation index <../tutorials/xr/index>`
  21. .. rst-class:: classref-reftable-group
  22. Properties
  23. ----------
  24. .. table::
  25. :widths: auto
  26. +--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------+
  27. | :ref:`bool<class_bool>` | :ref:`ar_is_anchor_detection_enabled<class_XRInterface_property_ar_is_anchor_detection_enabled>` | ``false`` |
  28. +--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------+
  29. | :ref:`EnvironmentBlendMode<enum_XRInterface_EnvironmentBlendMode>` | :ref:`environment_blend_mode<class_XRInterface_property_environment_blend_mode>` | ``0`` |
  30. +--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------+
  31. | :ref:`bool<class_bool>` | :ref:`interface_is_primary<class_XRInterface_property_interface_is_primary>` | ``false`` |
  32. +--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------+
  33. | :ref:`PlayAreaMode<enum_XRInterface_PlayAreaMode>` | :ref:`xr_play_area_mode<class_XRInterface_property_xr_play_area_mode>` | ``0`` |
  34. +--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------+
  35. .. rst-class:: classref-reftable-group
  36. Methods
  37. -------
  38. .. table::
  39. :widths: auto
  40. +--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`int<class_int>` | :ref:`get_camera_feed_id<class_XRInterface_method_get_camera_feed_id>`\ (\ ) |
  42. +--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`int<class_int>` | :ref:`get_capabilities<class_XRInterface_method_get_capabilities>`\ (\ ) |const| |
  44. +--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`StringName<class_StringName>` | :ref:`get_name<class_XRInterface_method_get_name>`\ (\ ) |const| |
  46. +--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`PackedVector3Array<class_PackedVector3Array>` | :ref:`get_play_area<class_XRInterface_method_get_play_area>`\ (\ ) |const| |
  48. +--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`Projection<class_Projection>` | :ref:`get_projection_for_view<class_XRInterface_method_get_projection_for_view>`\ (\ view\: :ref:`int<class_int>`, aspect\: :ref:`float<class_float>`, near\: :ref:`float<class_float>`, far\: :ref:`float<class_float>`\ ) |
  50. +--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`Vector2<class_Vector2>` | :ref:`get_render_target_size<class_XRInterface_method_get_render_target_size>`\ (\ ) |
  52. +--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`Array<class_Array>` | :ref:`get_supported_environment_blend_modes<class_XRInterface_method_get_supported_environment_blend_modes>`\ (\ ) |
  54. +--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`Dictionary<class_Dictionary>` | :ref:`get_system_info<class_XRInterface_method_get_system_info>`\ (\ ) |
  56. +--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | :ref:`TrackingStatus<enum_XRInterface_TrackingStatus>` | :ref:`get_tracking_status<class_XRInterface_method_get_tracking_status>`\ (\ ) |const| |
  58. +--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | :ref:`Transform3D<class_Transform3D>` | :ref:`get_transform_for_view<class_XRInterface_method_get_transform_for_view>`\ (\ view\: :ref:`int<class_int>`, cam_transform\: :ref:`Transform3D<class_Transform3D>`\ ) |
  60. +--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | :ref:`int<class_int>` | :ref:`get_view_count<class_XRInterface_method_get_view_count>`\ (\ ) |
  62. +--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | :ref:`bool<class_bool>` | :ref:`initialize<class_XRInterface_method_initialize>`\ (\ ) |
  64. +--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | :ref:`bool<class_bool>` | :ref:`is_initialized<class_XRInterface_method_is_initialized>`\ (\ ) |const| |
  66. +--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | :ref:`bool<class_bool>` | :ref:`is_passthrough_enabled<class_XRInterface_method_is_passthrough_enabled>`\ (\ ) |
  68. +--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | :ref:`bool<class_bool>` | :ref:`is_passthrough_supported<class_XRInterface_method_is_passthrough_supported>`\ (\ ) |
  70. +--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | :ref:`bool<class_bool>` | :ref:`set_environment_blend_mode<class_XRInterface_method_set_environment_blend_mode>`\ (\ mode\: :ref:`EnvironmentBlendMode<enum_XRInterface_EnvironmentBlendMode>`\ ) |
  72. +--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | :ref:`bool<class_bool>` | :ref:`set_play_area_mode<class_XRInterface_method_set_play_area_mode>`\ (\ mode\: :ref:`PlayAreaMode<enum_XRInterface_PlayAreaMode>`\ ) |
  74. +--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | :ref:`bool<class_bool>` | :ref:`start_passthrough<class_XRInterface_method_start_passthrough>`\ (\ ) |
  76. +--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | |void| | :ref:`stop_passthrough<class_XRInterface_method_stop_passthrough>`\ (\ ) |
  78. +--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | :ref:`bool<class_bool>` | :ref:`supports_play_area_mode<class_XRInterface_method_supports_play_area_mode>`\ (\ mode\: :ref:`PlayAreaMode<enum_XRInterface_PlayAreaMode>`\ ) |
  80. +--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | |void| | :ref:`trigger_haptic_pulse<class_XRInterface_method_trigger_haptic_pulse>`\ (\ action_name\: :ref:`String<class_String>`, tracker_name\: :ref:`StringName<class_StringName>`, frequency\: :ref:`float<class_float>`, amplitude\: :ref:`float<class_float>`, duration_sec\: :ref:`float<class_float>`, delay_sec\: :ref:`float<class_float>`\ ) |
  82. +--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | |void| | :ref:`uninitialize<class_XRInterface_method_uninitialize>`\ (\ ) |
  84. +--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. .. rst-class:: classref-section-separator
  86. ----
  87. .. rst-class:: classref-descriptions-group
  88. Signals
  89. -------
  90. .. _class_XRInterface_signal_play_area_changed:
  91. .. rst-class:: classref-signal
  92. **play_area_changed**\ (\ mode\: :ref:`int<class_int>`\ ) :ref:`🔗<class_XRInterface_signal_play_area_changed>`
  93. Emitted when the play area is changed. This can be a result of the player resetting the boundary or entering a new play area, the player changing the play area mode, the world scale changing or the player resetting their headset orientation.
  94. .. rst-class:: classref-section-separator
  95. ----
  96. .. rst-class:: classref-descriptions-group
  97. Enumerations
  98. ------------
  99. .. _enum_XRInterface_Capabilities:
  100. .. rst-class:: classref-enumeration
  101. enum **Capabilities**: :ref:`🔗<enum_XRInterface_Capabilities>`
  102. .. _class_XRInterface_constant_XR_NONE:
  103. .. rst-class:: classref-enumeration-constant
  104. :ref:`Capabilities<enum_XRInterface_Capabilities>` **XR_NONE** = ``0``
  105. No XR capabilities.
  106. .. _class_XRInterface_constant_XR_MONO:
  107. .. rst-class:: classref-enumeration-constant
  108. :ref:`Capabilities<enum_XRInterface_Capabilities>` **XR_MONO** = ``1``
  109. This interface can work with normal rendering output (non-HMD based AR).
  110. .. _class_XRInterface_constant_XR_STEREO:
  111. .. rst-class:: classref-enumeration-constant
  112. :ref:`Capabilities<enum_XRInterface_Capabilities>` **XR_STEREO** = ``2``
  113. This interface supports stereoscopic rendering.
  114. .. _class_XRInterface_constant_XR_QUAD:
  115. .. rst-class:: classref-enumeration-constant
  116. :ref:`Capabilities<enum_XRInterface_Capabilities>` **XR_QUAD** = ``4``
  117. This interface supports quad rendering (not yet supported by Godot).
  118. .. _class_XRInterface_constant_XR_VR:
  119. .. rst-class:: classref-enumeration-constant
  120. :ref:`Capabilities<enum_XRInterface_Capabilities>` **XR_VR** = ``8``
  121. This interface supports VR.
  122. .. _class_XRInterface_constant_XR_AR:
  123. .. rst-class:: classref-enumeration-constant
  124. :ref:`Capabilities<enum_XRInterface_Capabilities>` **XR_AR** = ``16``
  125. This interface supports AR (video background and real world tracking).
  126. .. _class_XRInterface_constant_XR_EXTERNAL:
  127. .. rst-class:: classref-enumeration-constant
  128. :ref:`Capabilities<enum_XRInterface_Capabilities>` **XR_EXTERNAL** = ``32``
  129. This interface outputs to an external device. If the main viewport is used, the on screen output is an unmodified buffer of either the left or right eye (stretched if the viewport size is not changed to the same aspect ratio of :ref:`get_render_target_size()<class_XRInterface_method_get_render_target_size>`). Using a separate viewport node frees up the main viewport for other purposes.
  130. .. rst-class:: classref-item-separator
  131. ----
  132. .. _enum_XRInterface_TrackingStatus:
  133. .. rst-class:: classref-enumeration
  134. enum **TrackingStatus**: :ref:`🔗<enum_XRInterface_TrackingStatus>`
  135. .. _class_XRInterface_constant_XR_NORMAL_TRACKING:
  136. .. rst-class:: classref-enumeration-constant
  137. :ref:`TrackingStatus<enum_XRInterface_TrackingStatus>` **XR_NORMAL_TRACKING** = ``0``
  138. Tracking is behaving as expected.
  139. .. _class_XRInterface_constant_XR_EXCESSIVE_MOTION:
  140. .. rst-class:: classref-enumeration-constant
  141. :ref:`TrackingStatus<enum_XRInterface_TrackingStatus>` **XR_EXCESSIVE_MOTION** = ``1``
  142. Tracking is hindered by excessive motion (the player is moving faster than tracking can keep up).
  143. .. _class_XRInterface_constant_XR_INSUFFICIENT_FEATURES:
  144. .. rst-class:: classref-enumeration-constant
  145. :ref:`TrackingStatus<enum_XRInterface_TrackingStatus>` **XR_INSUFFICIENT_FEATURES** = ``2``
  146. Tracking is hindered by insufficient features, it's too dark (for camera-based tracking), player is blocked, etc.
  147. .. _class_XRInterface_constant_XR_UNKNOWN_TRACKING:
  148. .. rst-class:: classref-enumeration-constant
  149. :ref:`TrackingStatus<enum_XRInterface_TrackingStatus>` **XR_UNKNOWN_TRACKING** = ``3``
  150. We don't know the status of the tracking or this interface does not provide feedback.
  151. .. _class_XRInterface_constant_XR_NOT_TRACKING:
  152. .. rst-class:: classref-enumeration-constant
  153. :ref:`TrackingStatus<enum_XRInterface_TrackingStatus>` **XR_NOT_TRACKING** = ``4``
  154. Tracking is not functional (camera not plugged in or obscured, lighthouses turned off, etc.).
  155. .. rst-class:: classref-item-separator
  156. ----
  157. .. _enum_XRInterface_PlayAreaMode:
  158. .. rst-class:: classref-enumeration
  159. enum **PlayAreaMode**: :ref:`🔗<enum_XRInterface_PlayAreaMode>`
  160. .. _class_XRInterface_constant_XR_PLAY_AREA_UNKNOWN:
  161. .. rst-class:: classref-enumeration-constant
  162. :ref:`PlayAreaMode<enum_XRInterface_PlayAreaMode>` **XR_PLAY_AREA_UNKNOWN** = ``0``
  163. Play area mode not set or not available.
  164. .. _class_XRInterface_constant_XR_PLAY_AREA_3DOF:
  165. .. rst-class:: classref-enumeration-constant
  166. :ref:`PlayAreaMode<enum_XRInterface_PlayAreaMode>` **XR_PLAY_AREA_3DOF** = ``1``
  167. Play area only supports orientation tracking, no positional tracking, area will center around player.
  168. .. _class_XRInterface_constant_XR_PLAY_AREA_SITTING:
  169. .. rst-class:: classref-enumeration-constant
  170. :ref:`PlayAreaMode<enum_XRInterface_PlayAreaMode>` **XR_PLAY_AREA_SITTING** = ``2``
  171. Player is in seated position, limited positional tracking, fixed guardian around player.
  172. .. _class_XRInterface_constant_XR_PLAY_AREA_ROOMSCALE:
  173. .. rst-class:: classref-enumeration-constant
  174. :ref:`PlayAreaMode<enum_XRInterface_PlayAreaMode>` **XR_PLAY_AREA_ROOMSCALE** = ``3``
  175. Player is free to move around, full positional tracking.
  176. .. _class_XRInterface_constant_XR_PLAY_AREA_STAGE:
  177. .. rst-class:: classref-enumeration-constant
  178. :ref:`PlayAreaMode<enum_XRInterface_PlayAreaMode>` **XR_PLAY_AREA_STAGE** = ``4``
  179. Same as :ref:`XR_PLAY_AREA_ROOMSCALE<class_XRInterface_constant_XR_PLAY_AREA_ROOMSCALE>` but origin point is fixed to the center of the physical space. In this mode, system-level recentering may be disabled, requiring the use of :ref:`XRServer.center_on_hmd()<class_XRServer_method_center_on_hmd>`.
  180. .. _class_XRInterface_constant_XR_PLAY_AREA_CUSTOM:
  181. .. rst-class:: classref-enumeration-constant
  182. :ref:`PlayAreaMode<enum_XRInterface_PlayAreaMode>` **XR_PLAY_AREA_CUSTOM** = ``2147483647``
  183. Custom play area set by a GDExtension.
  184. .. rst-class:: classref-item-separator
  185. ----
  186. .. _enum_XRInterface_EnvironmentBlendMode:
  187. .. rst-class:: classref-enumeration
  188. enum **EnvironmentBlendMode**: :ref:`🔗<enum_XRInterface_EnvironmentBlendMode>`
  189. .. _class_XRInterface_constant_XR_ENV_BLEND_MODE_OPAQUE:
  190. .. rst-class:: classref-enumeration-constant
  191. :ref:`EnvironmentBlendMode<enum_XRInterface_EnvironmentBlendMode>` **XR_ENV_BLEND_MODE_OPAQUE** = ``0``
  192. Opaque blend mode. This is typically used for VR devices.
  193. .. _class_XRInterface_constant_XR_ENV_BLEND_MODE_ADDITIVE:
  194. .. rst-class:: classref-enumeration-constant
  195. :ref:`EnvironmentBlendMode<enum_XRInterface_EnvironmentBlendMode>` **XR_ENV_BLEND_MODE_ADDITIVE** = ``1``
  196. Additive blend mode. This is typically used for AR devices or VR devices with passthrough.
  197. .. _class_XRInterface_constant_XR_ENV_BLEND_MODE_ALPHA_BLEND:
  198. .. rst-class:: classref-enumeration-constant
  199. :ref:`EnvironmentBlendMode<enum_XRInterface_EnvironmentBlendMode>` **XR_ENV_BLEND_MODE_ALPHA_BLEND** = ``2``
  200. Alpha blend mode. This is typically used for AR or VR devices with passthrough capabilities. The alpha channel controls how much of the passthrough is visible. Alpha of 0.0 means the passthrough is visible and this pixel works in ADDITIVE mode. Alpha of 1.0 means that the passthrough is not visible and this pixel works in OPAQUE mode.
  201. .. rst-class:: classref-item-separator
  202. ----
  203. .. _enum_XRInterface_VRSTextureFormat:
  204. .. rst-class:: classref-enumeration
  205. enum **VRSTextureFormat**: :ref:`🔗<enum_XRInterface_VRSTextureFormat>`
  206. .. _class_XRInterface_constant_XR_VRS_TEXTURE_FORMAT_UNIFIED:
  207. .. rst-class:: classref-enumeration-constant
  208. :ref:`VRSTextureFormat<enum_XRInterface_VRSTextureFormat>` **XR_VRS_TEXTURE_FORMAT_UNIFIED** = ``0``
  209. The texture format is the same as returned by :ref:`XRVRS.make_vrs_texture()<class_XRVRS_method_make_vrs_texture>`.
  210. .. _class_XRInterface_constant_XR_VRS_TEXTURE_FORMAT_FRAGMENT_SHADING_RATE:
  211. .. rst-class:: classref-enumeration-constant
  212. :ref:`VRSTextureFormat<enum_XRInterface_VRSTextureFormat>` **XR_VRS_TEXTURE_FORMAT_FRAGMENT_SHADING_RATE** = ``1``
  213. The texture format is the same as expected by the Vulkan ``VK_KHR_fragment_shading_rate`` extension.
  214. .. _class_XRInterface_constant_XR_VRS_TEXTURE_FORMAT_FRAGMENT_DENSITY_MAP:
  215. .. rst-class:: classref-enumeration-constant
  216. :ref:`VRSTextureFormat<enum_XRInterface_VRSTextureFormat>` **XR_VRS_TEXTURE_FORMAT_FRAGMENT_DENSITY_MAP** = ``2``
  217. The texture format is the same as expected by the Vulkan ``VK_EXT_fragment_density_map`` extension.
  218. .. rst-class:: classref-section-separator
  219. ----
  220. .. rst-class:: classref-descriptions-group
  221. Property Descriptions
  222. ---------------------
  223. .. _class_XRInterface_property_ar_is_anchor_detection_enabled:
  224. .. rst-class:: classref-property
  225. :ref:`bool<class_bool>` **ar_is_anchor_detection_enabled** = ``false`` :ref:`🔗<class_XRInterface_property_ar_is_anchor_detection_enabled>`
  226. .. rst-class:: classref-property-setget
  227. - |void| **set_anchor_detection_is_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
  228. - :ref:`bool<class_bool>` **get_anchor_detection_is_enabled**\ (\ )
  229. On an AR interface, ``true`` if anchor detection is enabled.
  230. .. rst-class:: classref-item-separator
  231. ----
  232. .. _class_XRInterface_property_environment_blend_mode:
  233. .. rst-class:: classref-property
  234. :ref:`EnvironmentBlendMode<enum_XRInterface_EnvironmentBlendMode>` **environment_blend_mode** = ``0`` :ref:`🔗<class_XRInterface_property_environment_blend_mode>`
  235. .. rst-class:: classref-property-setget
  236. - :ref:`bool<class_bool>` **set_environment_blend_mode**\ (\ mode\: :ref:`EnvironmentBlendMode<enum_XRInterface_EnvironmentBlendMode>`\ )
  237. - :ref:`EnvironmentBlendMode<enum_XRInterface_EnvironmentBlendMode>` **get_environment_blend_mode**\ (\ )
  238. Specify how XR should blend in the environment. This is specific to certain AR and passthrough devices where camera images are blended in by the XR compositor.
  239. .. rst-class:: classref-item-separator
  240. ----
  241. .. _class_XRInterface_property_interface_is_primary:
  242. .. rst-class:: classref-property
  243. :ref:`bool<class_bool>` **interface_is_primary** = ``false`` :ref:`🔗<class_XRInterface_property_interface_is_primary>`
  244. .. rst-class:: classref-property-setget
  245. - |void| **set_primary**\ (\ value\: :ref:`bool<class_bool>`\ )
  246. - :ref:`bool<class_bool>` **is_primary**\ (\ )
  247. ``true`` if this is the primary interface.
  248. .. rst-class:: classref-item-separator
  249. ----
  250. .. _class_XRInterface_property_xr_play_area_mode:
  251. .. rst-class:: classref-property
  252. :ref:`PlayAreaMode<enum_XRInterface_PlayAreaMode>` **xr_play_area_mode** = ``0`` :ref:`🔗<class_XRInterface_property_xr_play_area_mode>`
  253. .. rst-class:: classref-property-setget
  254. - :ref:`bool<class_bool>` **set_play_area_mode**\ (\ mode\: :ref:`PlayAreaMode<enum_XRInterface_PlayAreaMode>`\ )
  255. - :ref:`PlayAreaMode<enum_XRInterface_PlayAreaMode>` **get_play_area_mode**\ (\ )
  256. The play area mode for this interface.
  257. .. rst-class:: classref-section-separator
  258. ----
  259. .. rst-class:: classref-descriptions-group
  260. Method Descriptions
  261. -------------------
  262. .. _class_XRInterface_method_get_camera_feed_id:
  263. .. rst-class:: classref-method
  264. :ref:`int<class_int>` **get_camera_feed_id**\ (\ ) :ref:`🔗<class_XRInterface_method_get_camera_feed_id>`
  265. If this is an AR interface that requires displaying a camera feed as the background, this method returns the feed ID in the :ref:`CameraServer<class_CameraServer>` for this interface.
  266. .. rst-class:: classref-item-separator
  267. ----
  268. .. _class_XRInterface_method_get_capabilities:
  269. .. rst-class:: classref-method
  270. :ref:`int<class_int>` **get_capabilities**\ (\ ) |const| :ref:`🔗<class_XRInterface_method_get_capabilities>`
  271. Returns a combination of :ref:`Capabilities<enum_XRInterface_Capabilities>` flags providing information about the capabilities of this interface.
  272. .. rst-class:: classref-item-separator
  273. ----
  274. .. _class_XRInterface_method_get_name:
  275. .. rst-class:: classref-method
  276. :ref:`StringName<class_StringName>` **get_name**\ (\ ) |const| :ref:`🔗<class_XRInterface_method_get_name>`
  277. Returns the name of this interface (``"OpenXR"``, ``"OpenVR"``, ``"OpenHMD"``, ``"ARKit"``, etc.).
  278. .. rst-class:: classref-item-separator
  279. ----
  280. .. _class_XRInterface_method_get_play_area:
  281. .. rst-class:: classref-method
  282. :ref:`PackedVector3Array<class_PackedVector3Array>` **get_play_area**\ (\ ) |const| :ref:`🔗<class_XRInterface_method_get_play_area>`
  283. Returns an array of vectors that represent the physical play area mapped to the virtual space around the :ref:`XROrigin3D<class_XROrigin3D>` point. The points form a convex polygon that can be used to react to or visualize the play area. This returns an empty array if this feature is not supported or if the information is not yet available.
  284. .. rst-class:: classref-item-separator
  285. ----
  286. .. _class_XRInterface_method_get_projection_for_view:
  287. .. rst-class:: classref-method
  288. :ref:`Projection<class_Projection>` **get_projection_for_view**\ (\ view\: :ref:`int<class_int>`, aspect\: :ref:`float<class_float>`, near\: :ref:`float<class_float>`, far\: :ref:`float<class_float>`\ ) :ref:`🔗<class_XRInterface_method_get_projection_for_view>`
  289. Returns the projection matrix for a view/eye.
  290. .. rst-class:: classref-item-separator
  291. ----
  292. .. _class_XRInterface_method_get_render_target_size:
  293. .. rst-class:: classref-method
  294. :ref:`Vector2<class_Vector2>` **get_render_target_size**\ (\ ) :ref:`🔗<class_XRInterface_method_get_render_target_size>`
  295. Returns the resolution at which we should render our intermediate results before things like lens distortion are applied by the VR platform.
  296. .. rst-class:: classref-item-separator
  297. ----
  298. .. _class_XRInterface_method_get_supported_environment_blend_modes:
  299. .. rst-class:: classref-method
  300. :ref:`Array<class_Array>` **get_supported_environment_blend_modes**\ (\ ) :ref:`🔗<class_XRInterface_method_get_supported_environment_blend_modes>`
  301. Returns the an array of supported environment blend modes, see :ref:`EnvironmentBlendMode<enum_XRInterface_EnvironmentBlendMode>`.
  302. .. rst-class:: classref-item-separator
  303. ----
  304. .. _class_XRInterface_method_get_system_info:
  305. .. rst-class:: classref-method
  306. :ref:`Dictionary<class_Dictionary>` **get_system_info**\ (\ ) :ref:`🔗<class_XRInterface_method_get_system_info>`
  307. Returns a :ref:`Dictionary<class_Dictionary>` with extra system info. Interfaces are expected to return ``XRRuntimeName`` and ``XRRuntimeVersion`` providing info about the used XR runtime. Additional entries may be provided specific to an interface.
  308. \ **Note:**\ This information may only be available after :ref:`initialize()<class_XRInterface_method_initialize>` was successfully called.
  309. .. rst-class:: classref-item-separator
  310. ----
  311. .. _class_XRInterface_method_get_tracking_status:
  312. .. rst-class:: classref-method
  313. :ref:`TrackingStatus<enum_XRInterface_TrackingStatus>` **get_tracking_status**\ (\ ) |const| :ref:`🔗<class_XRInterface_method_get_tracking_status>`
  314. If supported, returns the status of our tracking. This will allow you to provide feedback to the user whether there are issues with positional tracking.
  315. .. rst-class:: classref-item-separator
  316. ----
  317. .. _class_XRInterface_method_get_transform_for_view:
  318. .. rst-class:: classref-method
  319. :ref:`Transform3D<class_Transform3D>` **get_transform_for_view**\ (\ view\: :ref:`int<class_int>`, cam_transform\: :ref:`Transform3D<class_Transform3D>`\ ) :ref:`🔗<class_XRInterface_method_get_transform_for_view>`
  320. Returns the transform for a view/eye.
  321. \ ``view`` is the view/eye index.
  322. \ ``cam_transform`` is the transform that maps device coordinates to scene coordinates, typically the :ref:`Node3D.global_transform<class_Node3D_property_global_transform>` of the current XROrigin3D.
  323. .. rst-class:: classref-item-separator
  324. ----
  325. .. _class_XRInterface_method_get_view_count:
  326. .. rst-class:: classref-method
  327. :ref:`int<class_int>` **get_view_count**\ (\ ) :ref:`🔗<class_XRInterface_method_get_view_count>`
  328. Returns the number of views that need to be rendered for this device. 1 for Monoscopic, 2 for Stereoscopic.
  329. .. rst-class:: classref-item-separator
  330. ----
  331. .. _class_XRInterface_method_initialize:
  332. .. rst-class:: classref-method
  333. :ref:`bool<class_bool>` **initialize**\ (\ ) :ref:`🔗<class_XRInterface_method_initialize>`
  334. Call this to initialize this interface. The first interface that is initialized is identified as the primary interface and it will be used for rendering output.
  335. After initializing the interface you want to use you then need to enable the AR/VR mode of a viewport and rendering should commence.
  336. \ **Note:** You must enable the XR mode on the main viewport for any device that uses the main output of Godot, such as for mobile VR.
  337. If you do this for a platform that handles its own output (such as OpenVR) Godot will show just one eye without distortion on screen. Alternatively, you can add a separate viewport node to your scene and enable AR/VR on that viewport. It will be used to output to the HMD, leaving you free to do anything you like in the main window, such as using a separate camera as a spectator camera or rendering something completely different.
  338. While currently not used, you can activate additional interfaces. You may wish to do this if you want to track controllers from other platforms. However, at this point in time only one interface can render to an HMD.
  339. .. rst-class:: classref-item-separator
  340. ----
  341. .. _class_XRInterface_method_is_initialized:
  342. .. rst-class:: classref-method
  343. :ref:`bool<class_bool>` **is_initialized**\ (\ ) |const| :ref:`🔗<class_XRInterface_method_is_initialized>`
  344. Returns ``true`` if this interface has been initialized.
  345. .. rst-class:: classref-item-separator
  346. ----
  347. .. _class_XRInterface_method_is_passthrough_enabled:
  348. .. rst-class:: classref-method
  349. :ref:`bool<class_bool>` **is_passthrough_enabled**\ (\ ) :ref:`🔗<class_XRInterface_method_is_passthrough_enabled>`
  350. **Deprecated:** Check if :ref:`environment_blend_mode<class_XRInterface_property_environment_blend_mode>` is :ref:`XR_ENV_BLEND_MODE_ALPHA_BLEND<class_XRInterface_constant_XR_ENV_BLEND_MODE_ALPHA_BLEND>`, instead.
  351. Returns ``true`` if passthrough is enabled.
  352. .. rst-class:: classref-item-separator
  353. ----
  354. .. _class_XRInterface_method_is_passthrough_supported:
  355. .. rst-class:: classref-method
  356. :ref:`bool<class_bool>` **is_passthrough_supported**\ (\ ) :ref:`🔗<class_XRInterface_method_is_passthrough_supported>`
  357. **Deprecated:** Check that :ref:`XR_ENV_BLEND_MODE_ALPHA_BLEND<class_XRInterface_constant_XR_ENV_BLEND_MODE_ALPHA_BLEND>` is supported using :ref:`get_supported_environment_blend_modes()<class_XRInterface_method_get_supported_environment_blend_modes>`, instead.
  358. Returns ``true`` if this interface supports passthrough.
  359. .. rst-class:: classref-item-separator
  360. ----
  361. .. _class_XRInterface_method_set_environment_blend_mode:
  362. .. rst-class:: classref-method
  363. :ref:`bool<class_bool>` **set_environment_blend_mode**\ (\ mode\: :ref:`EnvironmentBlendMode<enum_XRInterface_EnvironmentBlendMode>`\ ) :ref:`🔗<class_XRInterface_method_set_environment_blend_mode>`
  364. Sets the active environment blend mode.
  365. \ ``mode`` is the environment blend mode starting with the next frame.
  366. \ **Note:** Not all runtimes support all environment blend modes, so it is important to check this at startup. For example:
  367. ::
  368. func _ready():
  369. var xr_interface = XRServer.find_interface("OpenXR")
  370. if xr_interface and xr_interface.is_initialized():
  371. var vp = get_viewport()
  372. vp.use_xr = true
  373. var acceptable_modes = [XRInterface.XR_ENV_BLEND_MODE_OPAQUE, XRInterface.XR_ENV_BLEND_MODE_ADDITIVE]
  374. var modes = xr_interface.get_supported_environment_blend_modes()
  375. for mode in acceptable_modes:
  376. if mode in modes:
  377. xr_interface.set_environment_blend_mode(mode)
  378. break
  379. .. rst-class:: classref-item-separator
  380. ----
  381. .. _class_XRInterface_method_set_play_area_mode:
  382. .. rst-class:: classref-method
  383. :ref:`bool<class_bool>` **set_play_area_mode**\ (\ mode\: :ref:`PlayAreaMode<enum_XRInterface_PlayAreaMode>`\ ) :ref:`🔗<class_XRInterface_method_set_play_area_mode>`
  384. Sets the active play area mode, will return ``false`` if the mode can't be used with this interface.
  385. \ **Note:** Changing this after the interface has already been initialized can be jarring for the player, so it's recommended to recenter on the HMD with :ref:`XRServer.center_on_hmd()<class_XRServer_method_center_on_hmd>` (if switching to :ref:`XR_PLAY_AREA_STAGE<class_XRInterface_constant_XR_PLAY_AREA_STAGE>`) or make the switch during a scene change.
  386. .. rst-class:: classref-item-separator
  387. ----
  388. .. _class_XRInterface_method_start_passthrough:
  389. .. rst-class:: classref-method
  390. :ref:`bool<class_bool>` **start_passthrough**\ (\ ) :ref:`🔗<class_XRInterface_method_start_passthrough>`
  391. **Deprecated:** Set the :ref:`environment_blend_mode<class_XRInterface_property_environment_blend_mode>` to :ref:`XR_ENV_BLEND_MODE_ALPHA_BLEND<class_XRInterface_constant_XR_ENV_BLEND_MODE_ALPHA_BLEND>`, instead.
  392. Starts passthrough, will return ``false`` if passthrough couldn't be started.
  393. \ **Note:** The viewport used for XR must have a transparent background, otherwise passthrough may not properly render.
  394. .. rst-class:: classref-item-separator
  395. ----
  396. .. _class_XRInterface_method_stop_passthrough:
  397. .. rst-class:: classref-method
  398. |void| **stop_passthrough**\ (\ ) :ref:`🔗<class_XRInterface_method_stop_passthrough>`
  399. **Deprecated:** Set the :ref:`environment_blend_mode<class_XRInterface_property_environment_blend_mode>` to :ref:`XR_ENV_BLEND_MODE_OPAQUE<class_XRInterface_constant_XR_ENV_BLEND_MODE_OPAQUE>`, instead.
  400. Stops passthrough.
  401. .. rst-class:: classref-item-separator
  402. ----
  403. .. _class_XRInterface_method_supports_play_area_mode:
  404. .. rst-class:: classref-method
  405. :ref:`bool<class_bool>` **supports_play_area_mode**\ (\ mode\: :ref:`PlayAreaMode<enum_XRInterface_PlayAreaMode>`\ ) :ref:`🔗<class_XRInterface_method_supports_play_area_mode>`
  406. Call this to find out if a given play area mode is supported by this interface.
  407. .. rst-class:: classref-item-separator
  408. ----
  409. .. _class_XRInterface_method_trigger_haptic_pulse:
  410. .. rst-class:: classref-method
  411. |void| **trigger_haptic_pulse**\ (\ action_name\: :ref:`String<class_String>`, tracker_name\: :ref:`StringName<class_StringName>`, frequency\: :ref:`float<class_float>`, amplitude\: :ref:`float<class_float>`, duration_sec\: :ref:`float<class_float>`, delay_sec\: :ref:`float<class_float>`\ ) :ref:`🔗<class_XRInterface_method_trigger_haptic_pulse>`
  412. Triggers a haptic pulse on a device associated with this interface.
  413. \ ``action_name`` is the name of the action for this pulse.
  414. \ ``tracker_name`` is optional and can be used to direct the pulse to a specific device provided that device is bound to this haptic.
  415. \ ``frequency`` is the frequency of the pulse, set to ``0.0`` to have the system use a default frequency.
  416. \ ``amplitude`` is the amplitude of the pulse between ``0.0`` and ``1.0``.
  417. \ ``duration_sec`` is the duration of the pulse in seconds.
  418. \ ``delay_sec`` is a delay in seconds before the pulse is given.
  419. .. rst-class:: classref-item-separator
  420. ----
  421. .. _class_XRInterface_method_uninitialize:
  422. .. rst-class:: classref-method
  423. |void| **uninitialize**\ (\ ) :ref:`🔗<class_XRInterface_method_uninitialize>`
  424. Turns the interface off.
  425. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  426. .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
  427. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  428. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  429. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  430. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  431. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  432. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  433. .. |void| replace:: :abbr:`void (No return value.)`