class_xrpositionaltracker.rst 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  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/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_pose_lost_tracking:
  91. .. rst-class:: classref-signal
  92. **pose_lost_tracking** **(** :ref:`XRPose<class_XRPose>` pose **)**
  93. Emitted when a pose tracked by this tracker stops getting updated tracking data.
  94. .. rst-class:: classref-item-separator
  95. ----
  96. .. _class_XRPositionalTracker_signal_profile_changed:
  97. .. rst-class:: classref-signal
  98. **profile_changed** **(** :ref:`String<class_String>` role **)**
  99. Emitted when the profile of our tracker changes.
  100. .. rst-class:: classref-section-separator
  101. ----
  102. .. rst-class:: classref-descriptions-group
  103. Enumerations
  104. ------------
  105. .. _enum_XRPositionalTracker_TrackerHand:
  106. .. rst-class:: classref-enumeration
  107. enum **TrackerHand**:
  108. .. _class_XRPositionalTracker_constant_TRACKER_HAND_UNKNOWN:
  109. .. rst-class:: classref-enumeration-constant
  110. :ref:`TrackerHand<enum_XRPositionalTracker_TrackerHand>` **TRACKER_HAND_UNKNOWN** = ``0``
  111. The hand this tracker is held in is unknown or not applicable.
  112. .. _class_XRPositionalTracker_constant_TRACKER_HAND_LEFT:
  113. .. rst-class:: classref-enumeration-constant
  114. :ref:`TrackerHand<enum_XRPositionalTracker_TrackerHand>` **TRACKER_HAND_LEFT** = ``1``
  115. This tracker is the left hand controller.
  116. .. _class_XRPositionalTracker_constant_TRACKER_HAND_RIGHT:
  117. .. rst-class:: classref-enumeration-constant
  118. :ref:`TrackerHand<enum_XRPositionalTracker_TrackerHand>` **TRACKER_HAND_RIGHT** = ``2``
  119. This tracker is the right hand controller.
  120. .. rst-class:: classref-section-separator
  121. ----
  122. .. rst-class:: classref-descriptions-group
  123. Property Descriptions
  124. ---------------------
  125. .. _class_XRPositionalTracker_property_description:
  126. .. rst-class:: classref-property
  127. :ref:`String<class_String>` **description** = ``""``
  128. .. rst-class:: classref-property-setget
  129. - void **set_tracker_desc** **(** :ref:`String<class_String>` value **)**
  130. - :ref:`String<class_String>` **get_tracker_desc** **(** **)**
  131. The description of this tracker.
  132. .. rst-class:: classref-item-separator
  133. ----
  134. .. _class_XRPositionalTracker_property_hand:
  135. .. rst-class:: classref-property
  136. :ref:`TrackerHand<enum_XRPositionalTracker_TrackerHand>` **hand** = ``0``
  137. .. rst-class:: classref-property-setget
  138. - void **set_tracker_hand** **(** :ref:`TrackerHand<enum_XRPositionalTracker_TrackerHand>` value **)**
  139. - :ref:`TrackerHand<enum_XRPositionalTracker_TrackerHand>` **get_tracker_hand** **(** **)**
  140. Defines which hand this tracker relates to.
  141. .. rst-class:: classref-item-separator
  142. ----
  143. .. _class_XRPositionalTracker_property_name:
  144. .. rst-class:: classref-property
  145. :ref:`StringName<class_StringName>` **name** = ``&"Unknown"``
  146. .. rst-class:: classref-property-setget
  147. - void **set_tracker_name** **(** :ref:`StringName<class_StringName>` value **)**
  148. - :ref:`StringName<class_StringName>` **get_tracker_name** **(** **)**
  149. 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:
  150. - ``left_hand`` identifies the controller held in the players left hand
  151. - ``right_hand`` identifies the controller held in the players right hand
  152. .. rst-class:: classref-item-separator
  153. ----
  154. .. _class_XRPositionalTracker_property_profile:
  155. .. rst-class:: classref-property
  156. :ref:`String<class_String>` **profile** = ``""``
  157. .. rst-class:: classref-property-setget
  158. - void **set_tracker_profile** **(** :ref:`String<class_String>` value **)**
  159. - :ref:`String<class_String>` **get_tracker_profile** **(** **)**
  160. The profile associated with this tracker, interface dependent but will indicate the type of controller being tracked.
  161. .. rst-class:: classref-item-separator
  162. ----
  163. .. _class_XRPositionalTracker_property_type:
  164. .. rst-class:: classref-property
  165. :ref:`TrackerType<enum_XRServer_TrackerType>` **type** = ``128``
  166. .. rst-class:: classref-property-setget
  167. - void **set_tracker_type** **(** :ref:`TrackerType<enum_XRServer_TrackerType>` value **)**
  168. - :ref:`TrackerType<enum_XRServer_TrackerType>` **get_tracker_type** **(** **)**
  169. The type of tracker.
  170. .. rst-class:: classref-section-separator
  171. ----
  172. .. rst-class:: classref-descriptions-group
  173. Method Descriptions
  174. -------------------
  175. .. _class_XRPositionalTracker_method_get_input:
  176. .. rst-class:: classref-method
  177. :ref:`Variant<class_Variant>` **get_input** **(** :ref:`StringName<class_StringName>` name **)** |const|
  178. 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.
  179. .. rst-class:: classref-item-separator
  180. ----
  181. .. _class_XRPositionalTracker_method_get_pose:
  182. .. rst-class:: classref-method
  183. :ref:`XRPose<class_XRPose>` **get_pose** **(** :ref:`StringName<class_StringName>` name **)** |const|
  184. Returns the current :ref:`XRPose<class_XRPose>` state object for the bound ``name`` pose.
  185. .. rst-class:: classref-item-separator
  186. ----
  187. .. _class_XRPositionalTracker_method_has_pose:
  188. .. rst-class:: classref-method
  189. :ref:`bool<class_bool>` **has_pose** **(** :ref:`StringName<class_StringName>` name **)** |const|
  190. Returns ``true`` if the tracker is available and is currently tracking the bound ``name`` pose.
  191. .. rst-class:: classref-item-separator
  192. ----
  193. .. _class_XRPositionalTracker_method_invalidate_pose:
  194. .. rst-class:: classref-method
  195. void **invalidate_pose** **(** :ref:`StringName<class_StringName>` name **)**
  196. 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 lose tracking or just remain at their last known position.
  197. .. rst-class:: classref-item-separator
  198. ----
  199. .. _class_XRPositionalTracker_method_set_input:
  200. .. rst-class:: classref-method
  201. void **set_input** **(** :ref:`StringName<class_StringName>` name, :ref:`Variant<class_Variant>` value **)**
  202. Changes the value for the given input. This method is called by a :ref:`XRInterface<class_XRInterface>` implementation and should not be used directly.
  203. .. rst-class:: classref-item-separator
  204. ----
  205. .. _class_XRPositionalTracker_method_set_pose:
  206. .. rst-class:: classref-method
  207. 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 **)**
  208. 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.
  209. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  210. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  211. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  212. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  213. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  214. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  215. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`