class_xrserver.rst 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779
  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/XRServer.xml.
  6. .. _class_XRServer:
  7. XRServer
  8. ========
  9. **Inherits:** :ref:`Object<class_Object>`
  10. Server for AR and VR features.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. The AR/VR server is the heart of our Advanced and Virtual Reality solution and handles all the processing.
  15. .. rst-class:: classref-introduction-group
  16. Tutorials
  17. ---------
  18. - :doc:`XR documentation index <../tutorials/xr/index>`
  19. .. rst-class:: classref-reftable-group
  20. Properties
  21. ----------
  22. .. table::
  23. :widths: auto
  24. +---------------------------------------+---------------------------------------------------------------------+-----------------------------------------------------+
  25. | :ref:`XRInterface<class_XRInterface>` | :ref:`primary_interface<class_XRServer_property_primary_interface>` | |
  26. +---------------------------------------+---------------------------------------------------------------------+-----------------------------------------------------+
  27. | :ref:`Transform3D<class_Transform3D>` | :ref:`world_origin<class_XRServer_property_world_origin>` | ``Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)`` |
  28. +---------------------------------------+---------------------------------------------------------------------+-----------------------------------------------------+
  29. | :ref:`float<class_float>` | :ref:`world_scale<class_XRServer_property_world_scale>` | ``1.0`` |
  30. +---------------------------------------+---------------------------------------------------------------------+-----------------------------------------------------+
  31. .. rst-class:: classref-reftable-group
  32. Methods
  33. -------
  34. .. table::
  35. :widths: auto
  36. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | |void| | :ref:`add_body_tracker<class_XRServer_method_add_body_tracker>`\ (\ tracker_name\: :ref:`StringName<class_StringName>`, body_tracker\: :ref:`XRBodyTracker<class_XRBodyTracker>`\ ) |
  38. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | |void| | :ref:`add_face_tracker<class_XRServer_method_add_face_tracker>`\ (\ tracker_name\: :ref:`StringName<class_StringName>`, face_tracker\: :ref:`XRFaceTracker<class_XRFaceTracker>`\ ) |
  40. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | |void| | :ref:`add_hand_tracker<class_XRServer_method_add_hand_tracker>`\ (\ tracker_name\: :ref:`StringName<class_StringName>`, hand_tracker\: :ref:`XRHandTracker<class_XRHandTracker>`\ ) |
  42. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | |void| | :ref:`add_interface<class_XRServer_method_add_interface>`\ (\ interface\: :ref:`XRInterface<class_XRInterface>`\ ) |
  44. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | |void| | :ref:`add_tracker<class_XRServer_method_add_tracker>`\ (\ tracker\: :ref:`XRPositionalTracker<class_XRPositionalTracker>`\ ) |
  46. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | |void| | :ref:`center_on_hmd<class_XRServer_method_center_on_hmd>`\ (\ rotation_mode\: :ref:`RotationMode<enum_XRServer_RotationMode>`, keep_height\: :ref:`bool<class_bool>`\ ) |
  48. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`Transform3D<class_Transform3D>` | :ref:`clear_reference_frame<class_XRServer_method_clear_reference_frame>`\ (\ ) |const| |
  50. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`XRInterface<class_XRInterface>` | :ref:`find_interface<class_XRServer_method_find_interface>`\ (\ name\: :ref:`String<class_String>`\ ) |const| |
  52. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`XRBodyTracker<class_XRBodyTracker>` | :ref:`get_body_tracker<class_XRServer_method_get_body_tracker>`\ (\ tracker_name\: :ref:`StringName<class_StringName>`\ ) |const| |
  54. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`Dictionary<class_Dictionary>` | :ref:`get_body_trackers<class_XRServer_method_get_body_trackers>`\ (\ ) |const| |
  56. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | :ref:`XRFaceTracker<class_XRFaceTracker>` | :ref:`get_face_tracker<class_XRServer_method_get_face_tracker>`\ (\ tracker_name\: :ref:`StringName<class_StringName>`\ ) |const| |
  58. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | :ref:`Dictionary<class_Dictionary>` | :ref:`get_face_trackers<class_XRServer_method_get_face_trackers>`\ (\ ) |const| |
  60. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | :ref:`XRHandTracker<class_XRHandTracker>` | :ref:`get_hand_tracker<class_XRServer_method_get_hand_tracker>`\ (\ tracker_name\: :ref:`StringName<class_StringName>`\ ) |const| |
  62. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | :ref:`Dictionary<class_Dictionary>` | :ref:`get_hand_trackers<class_XRServer_method_get_hand_trackers>`\ (\ ) |const| |
  64. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | :ref:`Transform3D<class_Transform3D>` | :ref:`get_hmd_transform<class_XRServer_method_get_hmd_transform>`\ (\ ) |
  66. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | :ref:`XRInterface<class_XRInterface>` | :ref:`get_interface<class_XRServer_method_get_interface>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  68. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | :ref:`int<class_int>` | :ref:`get_interface_count<class_XRServer_method_get_interface_count>`\ (\ ) |const| |
  70. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | :ref:`Array<class_Array>`\[:ref:`Dictionary<class_Dictionary>`\] | :ref:`get_interfaces<class_XRServer_method_get_interfaces>`\ (\ ) |const| |
  72. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | :ref:`Transform3D<class_Transform3D>` | :ref:`get_reference_frame<class_XRServer_method_get_reference_frame>`\ (\ ) |const| |
  74. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | :ref:`XRPositionalTracker<class_XRPositionalTracker>` | :ref:`get_tracker<class_XRServer_method_get_tracker>`\ (\ tracker_name\: :ref:`StringName<class_StringName>`\ ) |const| |
  76. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | :ref:`Dictionary<class_Dictionary>` | :ref:`get_trackers<class_XRServer_method_get_trackers>`\ (\ tracker_types\: :ref:`int<class_int>`\ ) |
  78. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | |void| | :ref:`remove_body_tracker<class_XRServer_method_remove_body_tracker>`\ (\ tracker_name\: :ref:`StringName<class_StringName>`\ ) |
  80. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | |void| | :ref:`remove_face_tracker<class_XRServer_method_remove_face_tracker>`\ (\ tracker_name\: :ref:`StringName<class_StringName>`\ ) |
  82. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | |void| | :ref:`remove_hand_tracker<class_XRServer_method_remove_hand_tracker>`\ (\ tracker_name\: :ref:`StringName<class_StringName>`\ ) |
  84. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | |void| | :ref:`remove_interface<class_XRServer_method_remove_interface>`\ (\ interface\: :ref:`XRInterface<class_XRInterface>`\ ) |
  86. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | |void| | :ref:`remove_tracker<class_XRServer_method_remove_tracker>`\ (\ tracker\: :ref:`XRPositionalTracker<class_XRPositionalTracker>`\ ) |
  88. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  89. .. rst-class:: classref-section-separator
  90. ----
  91. .. rst-class:: classref-descriptions-group
  92. Signals
  93. -------
  94. .. _class_XRServer_signal_body_tracker_added:
  95. .. rst-class:: classref-signal
  96. **body_tracker_added**\ (\ tracker_name\: :ref:`StringName<class_StringName>`, body_tracker\: :ref:`XRBodyTracker<class_XRBodyTracker>`\ )
  97. Emitted when a new body tracker is added.
  98. .. rst-class:: classref-item-separator
  99. ----
  100. .. _class_XRServer_signal_body_tracker_removed:
  101. .. rst-class:: classref-signal
  102. **body_tracker_removed**\ (\ tracker_name\: :ref:`StringName<class_StringName>`\ )
  103. Emitted when a body tracker is removed.
  104. .. rst-class:: classref-item-separator
  105. ----
  106. .. _class_XRServer_signal_body_tracker_updated:
  107. .. rst-class:: classref-signal
  108. **body_tracker_updated**\ (\ tracker_name\: :ref:`StringName<class_StringName>`, body_tracker\: :ref:`XRBodyTracker<class_XRBodyTracker>`\ )
  109. Emitted when an existing body tracker is updated.
  110. .. rst-class:: classref-item-separator
  111. ----
  112. .. _class_XRServer_signal_face_tracker_added:
  113. .. rst-class:: classref-signal
  114. **face_tracker_added**\ (\ tracker_name\: :ref:`StringName<class_StringName>`, face_tracker\: :ref:`XRFaceTracker<class_XRFaceTracker>`\ )
  115. Emitted when a new face tracker is added.
  116. .. rst-class:: classref-item-separator
  117. ----
  118. .. _class_XRServer_signal_face_tracker_removed:
  119. .. rst-class:: classref-signal
  120. **face_tracker_removed**\ (\ tracker_name\: :ref:`StringName<class_StringName>`\ )
  121. Emitted when a face tracker is removed.
  122. .. rst-class:: classref-item-separator
  123. ----
  124. .. _class_XRServer_signal_face_tracker_updated:
  125. .. rst-class:: classref-signal
  126. **face_tracker_updated**\ (\ tracker_name\: :ref:`StringName<class_StringName>`, face_tracker\: :ref:`XRFaceTracker<class_XRFaceTracker>`\ )
  127. Emitted when an existing face tracker is updated.
  128. .. rst-class:: classref-item-separator
  129. ----
  130. .. _class_XRServer_signal_hand_tracker_added:
  131. .. rst-class:: classref-signal
  132. **hand_tracker_added**\ (\ tracker_name\: :ref:`StringName<class_StringName>`, hand_tracker\: :ref:`XRHandTracker<class_XRHandTracker>`\ )
  133. Emitted when a new hand tracker is added.
  134. .. rst-class:: classref-item-separator
  135. ----
  136. .. _class_XRServer_signal_hand_tracker_removed:
  137. .. rst-class:: classref-signal
  138. **hand_tracker_removed**\ (\ tracker_name\: :ref:`StringName<class_StringName>`\ )
  139. Emitted when a hand tracker is removed.
  140. .. rst-class:: classref-item-separator
  141. ----
  142. .. _class_XRServer_signal_hand_tracker_updated:
  143. .. rst-class:: classref-signal
  144. **hand_tracker_updated**\ (\ tracker_name\: :ref:`StringName<class_StringName>`, hand_tracker\: :ref:`XRHandTracker<class_XRHandTracker>`\ )
  145. Emitted when an existing hand tracker is updated.
  146. .. rst-class:: classref-item-separator
  147. ----
  148. .. _class_XRServer_signal_interface_added:
  149. .. rst-class:: classref-signal
  150. **interface_added**\ (\ interface_name\: :ref:`StringName<class_StringName>`\ )
  151. Emitted when a new interface has been added.
  152. .. rst-class:: classref-item-separator
  153. ----
  154. .. _class_XRServer_signal_interface_removed:
  155. .. rst-class:: classref-signal
  156. **interface_removed**\ (\ interface_name\: :ref:`StringName<class_StringName>`\ )
  157. Emitted when an interface is removed.
  158. .. rst-class:: classref-item-separator
  159. ----
  160. .. _class_XRServer_signal_tracker_added:
  161. .. rst-class:: classref-signal
  162. **tracker_added**\ (\ tracker_name\: :ref:`StringName<class_StringName>`, type\: :ref:`int<class_int>`\ )
  163. Emitted when a new tracker has been added. If you don't use a fixed number of controllers or if you're using :ref:`XRAnchor3D<class_XRAnchor3D>`\ s for an AR solution, it is important to react to this signal to add the appropriate :ref:`XRController3D<class_XRController3D>` or :ref:`XRAnchor3D<class_XRAnchor3D>` nodes related to this new tracker.
  164. .. rst-class:: classref-item-separator
  165. ----
  166. .. _class_XRServer_signal_tracker_removed:
  167. .. rst-class:: classref-signal
  168. **tracker_removed**\ (\ tracker_name\: :ref:`StringName<class_StringName>`, type\: :ref:`int<class_int>`\ )
  169. Emitted when a tracker is removed. You should remove any :ref:`XRController3D<class_XRController3D>` or :ref:`XRAnchor3D<class_XRAnchor3D>` points if applicable. This is not mandatory, the nodes simply become inactive and will be made active again when a new tracker becomes available (i.e. a new controller is switched on that takes the place of the previous one).
  170. .. rst-class:: classref-item-separator
  171. ----
  172. .. _class_XRServer_signal_tracker_updated:
  173. .. rst-class:: classref-signal
  174. **tracker_updated**\ (\ tracker_name\: :ref:`StringName<class_StringName>`, type\: :ref:`int<class_int>`\ )
  175. Emitted when an existing tracker has been updated. This can happen if the user switches controllers.
  176. .. rst-class:: classref-section-separator
  177. ----
  178. .. rst-class:: classref-descriptions-group
  179. Enumerations
  180. ------------
  181. .. _enum_XRServer_TrackerType:
  182. .. rst-class:: classref-enumeration
  183. enum **TrackerType**:
  184. .. _class_XRServer_constant_TRACKER_HEAD:
  185. .. rst-class:: classref-enumeration-constant
  186. :ref:`TrackerType<enum_XRServer_TrackerType>` **TRACKER_HEAD** = ``1``
  187. The tracker tracks the location of the players head. This is usually a location centered between the players eyes. Note that for handheld AR devices this can be the current location of the device.
  188. .. _class_XRServer_constant_TRACKER_CONTROLLER:
  189. .. rst-class:: classref-enumeration-constant
  190. :ref:`TrackerType<enum_XRServer_TrackerType>` **TRACKER_CONTROLLER** = ``2``
  191. The tracker tracks the location of a controller.
  192. .. _class_XRServer_constant_TRACKER_BASESTATION:
  193. .. rst-class:: classref-enumeration-constant
  194. :ref:`TrackerType<enum_XRServer_TrackerType>` **TRACKER_BASESTATION** = ``4``
  195. The tracker tracks the location of a base station.
  196. .. _class_XRServer_constant_TRACKER_ANCHOR:
  197. .. rst-class:: classref-enumeration-constant
  198. :ref:`TrackerType<enum_XRServer_TrackerType>` **TRACKER_ANCHOR** = ``8``
  199. The tracker tracks the location and size of an AR anchor.
  200. .. _class_XRServer_constant_TRACKER_ANY_KNOWN:
  201. .. rst-class:: classref-enumeration-constant
  202. :ref:`TrackerType<enum_XRServer_TrackerType>` **TRACKER_ANY_KNOWN** = ``127``
  203. Used internally to filter trackers of any known type.
  204. .. _class_XRServer_constant_TRACKER_UNKNOWN:
  205. .. rst-class:: classref-enumeration-constant
  206. :ref:`TrackerType<enum_XRServer_TrackerType>` **TRACKER_UNKNOWN** = ``128``
  207. Used internally if we haven't set the tracker type yet.
  208. .. _class_XRServer_constant_TRACKER_ANY:
  209. .. rst-class:: classref-enumeration-constant
  210. :ref:`TrackerType<enum_XRServer_TrackerType>` **TRACKER_ANY** = ``255``
  211. Used internally to select all trackers.
  212. .. rst-class:: classref-item-separator
  213. ----
  214. .. _enum_XRServer_RotationMode:
  215. .. rst-class:: classref-enumeration
  216. enum **RotationMode**:
  217. .. _class_XRServer_constant_RESET_FULL_ROTATION:
  218. .. rst-class:: classref-enumeration-constant
  219. :ref:`RotationMode<enum_XRServer_RotationMode>` **RESET_FULL_ROTATION** = ``0``
  220. Fully reset the orientation of the HMD. Regardless of what direction the user is looking to in the real world. The user will look dead ahead in the virtual world.
  221. .. _class_XRServer_constant_RESET_BUT_KEEP_TILT:
  222. .. rst-class:: classref-enumeration-constant
  223. :ref:`RotationMode<enum_XRServer_RotationMode>` **RESET_BUT_KEEP_TILT** = ``1``
  224. Resets the orientation but keeps the tilt of the device. So if we're looking down, we keep looking down but heading will be reset.
  225. .. _class_XRServer_constant_DONT_RESET_ROTATION:
  226. .. rst-class:: classref-enumeration-constant
  227. :ref:`RotationMode<enum_XRServer_RotationMode>` **DONT_RESET_ROTATION** = ``2``
  228. Does not reset the orientation of the HMD, only the position of the player gets centered.
  229. .. rst-class:: classref-section-separator
  230. ----
  231. .. rst-class:: classref-descriptions-group
  232. Property Descriptions
  233. ---------------------
  234. .. _class_XRServer_property_primary_interface:
  235. .. rst-class:: classref-property
  236. :ref:`XRInterface<class_XRInterface>` **primary_interface**
  237. .. rst-class:: classref-property-setget
  238. - |void| **set_primary_interface**\ (\ value\: :ref:`XRInterface<class_XRInterface>`\ )
  239. - :ref:`XRInterface<class_XRInterface>` **get_primary_interface**\ (\ )
  240. The primary :ref:`XRInterface<class_XRInterface>` currently bound to the **XRServer**.
  241. .. rst-class:: classref-item-separator
  242. ----
  243. .. _class_XRServer_property_world_origin:
  244. .. rst-class:: classref-property
  245. :ref:`Transform3D<class_Transform3D>` **world_origin** = ``Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)``
  246. .. rst-class:: classref-property-setget
  247. - |void| **set_world_origin**\ (\ value\: :ref:`Transform3D<class_Transform3D>`\ )
  248. - :ref:`Transform3D<class_Transform3D>` **get_world_origin**\ (\ )
  249. The current origin of our tracking space in the virtual world. This is used by the renderer to properly position the camera with new tracking data.
  250. \ **Note:** This property is managed by the current :ref:`XROrigin3D<class_XROrigin3D>` node. It is exposed for access from GDExtensions.
  251. .. rst-class:: classref-item-separator
  252. ----
  253. .. _class_XRServer_property_world_scale:
  254. .. rst-class:: classref-property
  255. :ref:`float<class_float>` **world_scale** = ``1.0``
  256. .. rst-class:: classref-property-setget
  257. - |void| **set_world_scale**\ (\ value\: :ref:`float<class_float>`\ )
  258. - :ref:`float<class_float>` **get_world_scale**\ (\ )
  259. The scale of the game world compared to the real world. By default, most AR/VR platforms assume that 1 game unit corresponds to 1 real world meter.
  260. .. rst-class:: classref-section-separator
  261. ----
  262. .. rst-class:: classref-descriptions-group
  263. Method Descriptions
  264. -------------------
  265. .. _class_XRServer_method_add_body_tracker:
  266. .. rst-class:: classref-method
  267. |void| **add_body_tracker**\ (\ tracker_name\: :ref:`StringName<class_StringName>`, body_tracker\: :ref:`XRBodyTracker<class_XRBodyTracker>`\ )
  268. Registers a new :ref:`XRBodyTracker<class_XRBodyTracker>` that tracks the joints of a body.
  269. .. rst-class:: classref-item-separator
  270. ----
  271. .. _class_XRServer_method_add_face_tracker:
  272. .. rst-class:: classref-method
  273. |void| **add_face_tracker**\ (\ tracker_name\: :ref:`StringName<class_StringName>`, face_tracker\: :ref:`XRFaceTracker<class_XRFaceTracker>`\ )
  274. Registers a new :ref:`XRFaceTracker<class_XRFaceTracker>` that tracks the blend shapes of a face.
  275. .. rst-class:: classref-item-separator
  276. ----
  277. .. _class_XRServer_method_add_hand_tracker:
  278. .. rst-class:: classref-method
  279. |void| **add_hand_tracker**\ (\ tracker_name\: :ref:`StringName<class_StringName>`, hand_tracker\: :ref:`XRHandTracker<class_XRHandTracker>`\ )
  280. Registers a new :ref:`XRHandTracker<class_XRHandTracker>` that tracks the joints of a hand.
  281. .. rst-class:: classref-item-separator
  282. ----
  283. .. _class_XRServer_method_add_interface:
  284. .. rst-class:: classref-method
  285. |void| **add_interface**\ (\ interface\: :ref:`XRInterface<class_XRInterface>`\ )
  286. Registers an :ref:`XRInterface<class_XRInterface>` object.
  287. .. rst-class:: classref-item-separator
  288. ----
  289. .. _class_XRServer_method_add_tracker:
  290. .. rst-class:: classref-method
  291. |void| **add_tracker**\ (\ tracker\: :ref:`XRPositionalTracker<class_XRPositionalTracker>`\ )
  292. Registers a new :ref:`XRPositionalTracker<class_XRPositionalTracker>` that tracks a spatial location in real space.
  293. .. rst-class:: classref-item-separator
  294. ----
  295. .. _class_XRServer_method_center_on_hmd:
  296. .. rst-class:: classref-method
  297. |void| **center_on_hmd**\ (\ rotation_mode\: :ref:`RotationMode<enum_XRServer_RotationMode>`, keep_height\: :ref:`bool<class_bool>`\ )
  298. This is an important function to understand correctly. AR and VR platforms all handle positioning slightly differently.
  299. For platforms that do not offer spatial tracking, our origin point (0, 0, 0) is the location of our HMD, but you have little control over the direction the player is facing in the real world.
  300. For platforms that do offer spatial tracking, our origin point depends very much on the system. For OpenVR, our origin point is usually the center of the tracking space, on the ground. For other platforms, it's often the location of the tracking camera.
  301. This method allows you to center your tracker on the location of the HMD. It will take the current location of the HMD and use that to adjust all your tracking data; in essence, realigning the real world to your player's current position in the game world.
  302. For this method to produce usable results, tracking information must be available. This often takes a few frames after starting your game.
  303. You should call this method after a few seconds have passed. For example, when the user requests a realignment of the display holding a designated button on a controller for a short period of time, or when implementing a teleport mechanism.
  304. .. rst-class:: classref-item-separator
  305. ----
  306. .. _class_XRServer_method_clear_reference_frame:
  307. .. rst-class:: classref-method
  308. :ref:`Transform3D<class_Transform3D>` **clear_reference_frame**\ (\ ) |const|
  309. Clears the reference frame that was set by previous calls to :ref:`center_on_hmd<class_XRServer_method_center_on_hmd>`.
  310. .. rst-class:: classref-item-separator
  311. ----
  312. .. _class_XRServer_method_find_interface:
  313. .. rst-class:: classref-method
  314. :ref:`XRInterface<class_XRInterface>` **find_interface**\ (\ name\: :ref:`String<class_String>`\ ) |const|
  315. Finds an interface by its ``name``. For example, if your project uses capabilities of an AR/VR platform, you can find the interface for that platform by name and initialize it.
  316. .. rst-class:: classref-item-separator
  317. ----
  318. .. _class_XRServer_method_get_body_tracker:
  319. .. rst-class:: classref-method
  320. :ref:`XRBodyTracker<class_XRBodyTracker>` **get_body_tracker**\ (\ tracker_name\: :ref:`StringName<class_StringName>`\ ) |const|
  321. Returns the :ref:`XRBodyTracker<class_XRBodyTracker>` with the given tracker name.
  322. .. rst-class:: classref-item-separator
  323. ----
  324. .. _class_XRServer_method_get_body_trackers:
  325. .. rst-class:: classref-method
  326. :ref:`Dictionary<class_Dictionary>` **get_body_trackers**\ (\ ) |const|
  327. Returns a dictionary of the registered body trackers. Each element of the dictionary is a tracker name mapping to the :ref:`XRBodyTracker<class_XRBodyTracker>` instance.
  328. .. rst-class:: classref-item-separator
  329. ----
  330. .. _class_XRServer_method_get_face_tracker:
  331. .. rst-class:: classref-method
  332. :ref:`XRFaceTracker<class_XRFaceTracker>` **get_face_tracker**\ (\ tracker_name\: :ref:`StringName<class_StringName>`\ ) |const|
  333. Returns the :ref:`XRFaceTracker<class_XRFaceTracker>` with the given tracker name.
  334. .. rst-class:: classref-item-separator
  335. ----
  336. .. _class_XRServer_method_get_face_trackers:
  337. .. rst-class:: classref-method
  338. :ref:`Dictionary<class_Dictionary>` **get_face_trackers**\ (\ ) |const|
  339. Returns a dictionary of the registered face trackers. Each element of the dictionary is a tracker name mapping to the :ref:`XRFaceTracker<class_XRFaceTracker>` instance.
  340. .. rst-class:: classref-item-separator
  341. ----
  342. .. _class_XRServer_method_get_hand_tracker:
  343. .. rst-class:: classref-method
  344. :ref:`XRHandTracker<class_XRHandTracker>` **get_hand_tracker**\ (\ tracker_name\: :ref:`StringName<class_StringName>`\ ) |const|
  345. Returns the :ref:`XRHandTracker<class_XRHandTracker>` with the given tracker name.
  346. .. rst-class:: classref-item-separator
  347. ----
  348. .. _class_XRServer_method_get_hand_trackers:
  349. .. rst-class:: classref-method
  350. :ref:`Dictionary<class_Dictionary>` **get_hand_trackers**\ (\ ) |const|
  351. Returns a dictionary of the registered hand trackers. Each element of the dictionary is a tracker name mapping to the :ref:`XRHandTracker<class_XRHandTracker>` instance.
  352. .. rst-class:: classref-item-separator
  353. ----
  354. .. _class_XRServer_method_get_hmd_transform:
  355. .. rst-class:: classref-method
  356. :ref:`Transform3D<class_Transform3D>` **get_hmd_transform**\ (\ )
  357. Returns the primary interface's transformation.
  358. .. rst-class:: classref-item-separator
  359. ----
  360. .. _class_XRServer_method_get_interface:
  361. .. rst-class:: classref-method
  362. :ref:`XRInterface<class_XRInterface>` **get_interface**\ (\ idx\: :ref:`int<class_int>`\ ) |const|
  363. Returns the interface registered at the given ``idx`` index in the list of interfaces.
  364. .. rst-class:: classref-item-separator
  365. ----
  366. .. _class_XRServer_method_get_interface_count:
  367. .. rst-class:: classref-method
  368. :ref:`int<class_int>` **get_interface_count**\ (\ ) |const|
  369. Returns the number of interfaces currently registered with the AR/VR server. If your project supports multiple AR/VR platforms, you can look through the available interface, and either present the user with a selection or simply try to initialize each interface and use the first one that returns ``true``.
  370. .. rst-class:: classref-item-separator
  371. ----
  372. .. _class_XRServer_method_get_interfaces:
  373. .. rst-class:: classref-method
  374. :ref:`Array<class_Array>`\[:ref:`Dictionary<class_Dictionary>`\] **get_interfaces**\ (\ ) |const|
  375. Returns a list of available interfaces the ID and name of each interface.
  376. .. rst-class:: classref-item-separator
  377. ----
  378. .. _class_XRServer_method_get_reference_frame:
  379. .. rst-class:: classref-method
  380. :ref:`Transform3D<class_Transform3D>` **get_reference_frame**\ (\ ) |const|
  381. Returns the reference frame transform. Mostly used internally and exposed for GDExtension build interfaces.
  382. .. rst-class:: classref-item-separator
  383. ----
  384. .. _class_XRServer_method_get_tracker:
  385. .. rst-class:: classref-method
  386. :ref:`XRPositionalTracker<class_XRPositionalTracker>` **get_tracker**\ (\ tracker_name\: :ref:`StringName<class_StringName>`\ ) |const|
  387. Returns the positional tracker with the given ``tracker_name``.
  388. .. rst-class:: classref-item-separator
  389. ----
  390. .. _class_XRServer_method_get_trackers:
  391. .. rst-class:: classref-method
  392. :ref:`Dictionary<class_Dictionary>` **get_trackers**\ (\ tracker_types\: :ref:`int<class_int>`\ )
  393. Returns a dictionary of trackers for ``tracker_types``.
  394. .. rst-class:: classref-item-separator
  395. ----
  396. .. _class_XRServer_method_remove_body_tracker:
  397. .. rst-class:: classref-method
  398. |void| **remove_body_tracker**\ (\ tracker_name\: :ref:`StringName<class_StringName>`\ )
  399. Removes a registered :ref:`XRBodyTracker<class_XRBodyTracker>`.
  400. .. rst-class:: classref-item-separator
  401. ----
  402. .. _class_XRServer_method_remove_face_tracker:
  403. .. rst-class:: classref-method
  404. |void| **remove_face_tracker**\ (\ tracker_name\: :ref:`StringName<class_StringName>`\ )
  405. Removes a registered :ref:`XRFaceTracker<class_XRFaceTracker>`.
  406. .. rst-class:: classref-item-separator
  407. ----
  408. .. _class_XRServer_method_remove_hand_tracker:
  409. .. rst-class:: classref-method
  410. |void| **remove_hand_tracker**\ (\ tracker_name\: :ref:`StringName<class_StringName>`\ )
  411. Removes a registered :ref:`XRHandTracker<class_XRHandTracker>`.
  412. .. rst-class:: classref-item-separator
  413. ----
  414. .. _class_XRServer_method_remove_interface:
  415. .. rst-class:: classref-method
  416. |void| **remove_interface**\ (\ interface\: :ref:`XRInterface<class_XRInterface>`\ )
  417. Removes this ``interface``.
  418. .. rst-class:: classref-item-separator
  419. ----
  420. .. _class_XRServer_method_remove_tracker:
  421. .. rst-class:: classref-method
  422. |void| **remove_tracker**\ (\ tracker\: :ref:`XRPositionalTracker<class_XRPositionalTracker>`\ )
  423. Removes this positional ``tracker``.
  424. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  425. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  426. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  427. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  428. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  429. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  430. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  431. .. |void| replace:: :abbr:`void (No return value.)`