class_xrpositionaltracker.rst 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  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/4.0/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.0/doc/classes/XRPositionalTracker.xml.
  6. .. _class_XRPositionalTracker:
  7. XRPositionalTracker
  8. ===================
  9. **Inherits:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. A tracked object.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. An instance of this object represents a device that is tracked, such as a controller or anchor point. HMDs aren't represented here as they are handled internally.
  15. As controllers are turned on and the :ref:`XRInterface<class_XRInterface>` detects them, instances of this object are automatically added to this list of active tracking objects accessible through the :ref:`XRServer<class_XRServer>`.
  16. The :ref:`XRController3D<class_XRController3D>` and :ref:`XRAnchor3D<class_XRAnchor3D>` both consume objects of this type and should be used in your project. The positional trackers are just under-the-hood objects that make this all work. These are mostly exposed so that GDExtension-based interfaces can interact with them.
  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:`String<class_String>` | :ref:`description<class_XRPositionalTracker_property_description>` | ``""`` |
  28. +----------------------------------------------------------+--------------------------------------------------------------------+----------------+
  29. | :ref:`TrackerHand<enum_XRPositionalTracker_TrackerHand>` | :ref:`hand<class_XRPositionalTracker_property_hand>` | ``0`` |
  30. +----------------------------------------------------------+--------------------------------------------------------------------+----------------+
  31. | :ref:`StringName<class_StringName>` | :ref:`name<class_XRPositionalTracker_property_name>` | ``&"Unknown"`` |
  32. +----------------------------------------------------------+--------------------------------------------------------------------+----------------+
  33. | :ref:`String<class_String>` | :ref:`profile<class_XRPositionalTracker_property_profile>` | ``""`` |
  34. +----------------------------------------------------------+--------------------------------------------------------------------+----------------+
  35. | :ref:`TrackerType<enum_XRServer_TrackerType>` | :ref:`type<class_XRPositionalTracker_property_type>` | ``128`` |
  36. +----------------------------------------------------------+--------------------------------------------------------------------+----------------+
  37. .. rst-class:: classref-reftable-group
  38. Methods
  39. -------
  40. .. table::
  41. :widths: auto
  42. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`Variant<class_Variant>` | :ref:`get_input<class_XRPositionalTracker_method_get_input>` **(** :ref:`StringName<class_StringName>` name **)** |const| |
  44. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`XRPose<class_XRPose>` | :ref:`get_pose<class_XRPositionalTracker_method_get_pose>` **(** :ref:`StringName<class_StringName>` name **)** |const| |
  46. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`bool<class_bool>` | :ref:`has_pose<class_XRPositionalTracker_method_has_pose>` **(** :ref:`StringName<class_StringName>` name **)** |const| |
  48. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | void | :ref:`invalidate_pose<class_XRPositionalTracker_method_invalidate_pose>` **(** :ref:`StringName<class_StringName>` name **)** |
  50. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | void | :ref:`set_input<class_XRPositionalTracker_method_set_input>` **(** :ref:`StringName<class_StringName>` name, :ref:`Variant<class_Variant>` value **)** |
  52. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | void | :ref:`set_pose<class_XRPositionalTracker_method_set_pose>` **(** :ref:`StringName<class_StringName>` name, :ref:`Transform3D<class_Transform3D>` transform, :ref:`Vector3<class_Vector3>` linear_velocity, :ref:`Vector3<class_Vector3>` angular_velocity, :ref:`TrackingConfidence<enum_XRPose_TrackingConfidence>` tracking_confidence **)** |
  54. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. .. rst-class:: classref-section-separator
  56. ----
  57. .. rst-class:: classref-descriptions-group
  58. Signals
  59. -------
  60. .. _class_XRPositionalTracker_signal_button_pressed:
  61. .. rst-class:: classref-signal
  62. **button_pressed** **(** :ref:`String<class_String>` name **)**
  63. Emitted when a button on this tracker is pressed. Note that many XR runtimes allow other inputs to be mapped to buttons.
  64. .. rst-class:: classref-item-separator
  65. ----
  66. .. _class_XRPositionalTracker_signal_button_released:
  67. .. rst-class:: classref-signal
  68. **button_released** **(** :ref:`String<class_String>` name **)**
  69. Emitted when a button on this tracker is released.
  70. .. rst-class:: classref-item-separator
  71. ----
  72. .. _class_XRPositionalTracker_signal_input_float_changed:
  73. .. rst-class:: classref-signal
  74. **input_float_changed** **(** :ref:`String<class_String>` name, :ref:`float<class_float>` value **)**
  75. Emitted when a trigger or similar input on this tracker changes value.
  76. .. rst-class:: classref-item-separator
  77. ----
  78. .. _class_XRPositionalTracker_signal_input_vector2_changed:
  79. .. rst-class:: classref-signal
  80. **input_vector2_changed** **(** :ref:`String<class_String>` name, :ref:`Vector2<class_Vector2>` vector **)**
  81. Emitted when a thumbstick or thumbpad on this tracker moves.
  82. .. rst-class:: classref-item-separator
  83. ----
  84. .. _class_XRPositionalTracker_signal_pose_changed:
  85. .. rst-class:: classref-signal
  86. **pose_changed** **(** :ref:`XRPose<class_XRPose>` pose **)**
  87. Emitted when the state of a pose tracked by this tracker changes.
  88. .. rst-class:: classref-item-separator
  89. ----
  90. .. _class_XRPositionalTracker_signal_profile_changed:
  91. .. rst-class:: classref-signal
  92. **profile_changed** **(** :ref:`String<class_String>` role **)**
  93. Emitted when the profile of our tracker changes.
  94. .. rst-class:: classref-section-separator
  95. ----
  96. .. rst-class:: classref-descriptions-group
  97. Enumerations
  98. ------------
  99. .. _enum_XRPositionalTracker_TrackerHand:
  100. .. rst-class:: classref-enumeration
  101. enum **TrackerHand**:
  102. .. _class_XRPositionalTracker_constant_TRACKER_HAND_UNKNOWN:
  103. .. rst-class:: classref-enumeration-constant
  104. :ref:`TrackerHand<enum_XRPositionalTracker_TrackerHand>` **TRACKER_HAND_UNKNOWN** = ``0``
  105. The hand this tracker is held in is unknown or not applicable.
  106. .. _class_XRPositionalTracker_constant_TRACKER_HAND_LEFT:
  107. .. rst-class:: classref-enumeration-constant
  108. :ref:`TrackerHand<enum_XRPositionalTracker_TrackerHand>` **TRACKER_HAND_LEFT** = ``1``
  109. This tracker is the left hand controller.
  110. .. _class_XRPositionalTracker_constant_TRACKER_HAND_RIGHT:
  111. .. rst-class:: classref-enumeration-constant
  112. :ref:`TrackerHand<enum_XRPositionalTracker_TrackerHand>` **TRACKER_HAND_RIGHT** = ``2``
  113. This tracker is the right hand controller.
  114. .. rst-class:: classref-section-separator
  115. ----
  116. .. rst-class:: classref-descriptions-group
  117. Property Descriptions
  118. ---------------------
  119. .. _class_XRPositionalTracker_property_description:
  120. .. rst-class:: classref-property
  121. :ref:`String<class_String>` **description** = ``""``
  122. .. rst-class:: classref-property-setget
  123. - void **set_tracker_desc** **(** :ref:`String<class_String>` value **)**
  124. - :ref:`String<class_String>` **get_tracker_desc** **(** **)**
  125. The description of this tracker.
  126. .. rst-class:: classref-item-separator
  127. ----
  128. .. _class_XRPositionalTracker_property_hand:
  129. .. rst-class:: classref-property
  130. :ref:`TrackerHand<enum_XRPositionalTracker_TrackerHand>` **hand** = ``0``
  131. .. rst-class:: classref-property-setget
  132. - void **set_tracker_hand** **(** :ref:`TrackerHand<enum_XRPositionalTracker_TrackerHand>` value **)**
  133. - :ref:`TrackerHand<enum_XRPositionalTracker_TrackerHand>` **get_tracker_hand** **(** **)**
  134. Defines which hand this tracker relates to.
  135. .. rst-class:: classref-item-separator
  136. ----
  137. .. _class_XRPositionalTracker_property_name:
  138. .. rst-class:: classref-property
  139. :ref:`StringName<class_StringName>` **name** = ``&"Unknown"``
  140. .. rst-class:: classref-property-setget
  141. - void **set_tracker_name** **(** :ref:`StringName<class_StringName>` value **)**
  142. - :ref:`StringName<class_StringName>` **get_tracker_name** **(** **)**
  143. The unique name of this tracker. The trackers that are available differ between various XR runtimes and can often be configured by the user. Godot maintains a number of reserved names that it expects the :ref:`XRInterface<class_XRInterface>` to implement if applicable:
  144. - ``left_hand`` identifies the controller held in the players left hand
  145. - ``right_hand`` identifies the controller held in the players right hand
  146. .. rst-class:: classref-item-separator
  147. ----
  148. .. _class_XRPositionalTracker_property_profile:
  149. .. rst-class:: classref-property
  150. :ref:`String<class_String>` **profile** = ``""``
  151. .. rst-class:: classref-property-setget
  152. - void **set_tracker_profile** **(** :ref:`String<class_String>` value **)**
  153. - :ref:`String<class_String>` **get_tracker_profile** **(** **)**
  154. The profile associated with this tracker, interface dependent but will indicate the type of controller being tracked.
  155. .. rst-class:: classref-item-separator
  156. ----
  157. .. _class_XRPositionalTracker_property_type:
  158. .. rst-class:: classref-property
  159. :ref:`TrackerType<enum_XRServer_TrackerType>` **type** = ``128``
  160. .. rst-class:: classref-property-setget
  161. - void **set_tracker_type** **(** :ref:`TrackerType<enum_XRServer_TrackerType>` value **)**
  162. - :ref:`TrackerType<enum_XRServer_TrackerType>` **get_tracker_type** **(** **)**
  163. The type of tracker.
  164. .. rst-class:: classref-section-separator
  165. ----
  166. .. rst-class:: classref-descriptions-group
  167. Method Descriptions
  168. -------------------
  169. .. _class_XRPositionalTracker_method_get_input:
  170. .. rst-class:: classref-method
  171. :ref:`Variant<class_Variant>` **get_input** **(** :ref:`StringName<class_StringName>` name **)** |const|
  172. Returns an input for this tracker. It can return a boolean, float or :ref:`Vector2<class_Vector2>` value depending on whether the input is a button, trigger or thumbstick/thumbpad.
  173. .. rst-class:: classref-item-separator
  174. ----
  175. .. _class_XRPositionalTracker_method_get_pose:
  176. .. rst-class:: classref-method
  177. :ref:`XRPose<class_XRPose>` **get_pose** **(** :ref:`StringName<class_StringName>` name **)** |const|
  178. Returns the current :ref:`XRPose<class_XRPose>` state object for the bound ``name`` pose.
  179. .. rst-class:: classref-item-separator
  180. ----
  181. .. _class_XRPositionalTracker_method_has_pose:
  182. .. rst-class:: classref-method
  183. :ref:`bool<class_bool>` **has_pose** **(** :ref:`StringName<class_StringName>` name **)** |const|
  184. Returns ``true`` if the tracker is available and is currently tracking the bound ``name`` pose.
  185. .. rst-class:: classref-item-separator
  186. ----
  187. .. _class_XRPositionalTracker_method_invalidate_pose:
  188. .. rst-class:: classref-method
  189. void **invalidate_pose** **(** :ref:`StringName<class_StringName>` name **)**
  190. Marks this pose as invalid, we don't clear the last reported state but it allows users to decide if trackers need to be hidden if we loose tracking or just remain at their last known position.
  191. .. rst-class:: classref-item-separator
  192. ----
  193. .. _class_XRPositionalTracker_method_set_input:
  194. .. rst-class:: classref-method
  195. void **set_input** **(** :ref:`StringName<class_StringName>` name, :ref:`Variant<class_Variant>` value **)**
  196. Changes the value for the given input. This method is called by a :ref:`XRInterface<class_XRInterface>` implementation and should not be used directly.
  197. .. rst-class:: classref-item-separator
  198. ----
  199. .. _class_XRPositionalTracker_method_set_pose:
  200. .. rst-class:: classref-method
  201. void **set_pose** **(** :ref:`StringName<class_StringName>` name, :ref:`Transform3D<class_Transform3D>` transform, :ref:`Vector3<class_Vector3>` linear_velocity, :ref:`Vector3<class_Vector3>` angular_velocity, :ref:`TrackingConfidence<enum_XRPose_TrackingConfidence>` tracking_confidence **)**
  202. Sets the transform, linear velocity, angular velocity and tracking confidence for the given pose. This method is called by a :ref:`XRInterface<class_XRInterface>` implementation and should not be used directly.
  203. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  204. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  205. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  206. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  207. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  208. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`