class_xrcontroller3d.rst 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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/XRController3D.xml.
  6. .. _class_XRController3D:
  7. XRController3D
  8. ==============
  9. **Inherits:** :ref:`XRNode3D<class_XRNode3D>` **<** :ref:`Node3D<class_Node3D>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. A 3D node representing a spatially-tracked controller.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. This is a helper 3D node that is linked to the tracking of controllers. It also offers several handy passthroughs to the state of buttons and such on the controllers.
  15. Controllers are linked by their ID. You can create controller nodes before the controllers are available. If your game always uses two controllers (one for each hand), you can predefine the controllers with ID 1 and 2; they will become active as soon as the controllers are identified. If you expect additional controllers to be used, you should react to the signals and add XRController3D nodes to your scene.
  16. The position of the controller node is automatically updated by the :ref:`XRServer<class_XRServer>`. This makes this node ideal to add child nodes to visualize the controller.
  17. The current :ref:`XRInterface<class_XRInterface>` defines the names of inputs. In the case of OpenXR, these are the names of actions in the current action set from the OpenXR action map.
  18. .. rst-class:: classref-introduction-group
  19. Tutorials
  20. ---------
  21. - :doc:`XR documentation index <../tutorials/xr/index>`
  22. .. rst-class:: classref-reftable-group
  23. Methods
  24. -------
  25. .. table::
  26. :widths: auto
  27. +----------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`float<class_float>` | :ref:`get_float<class_XRController3D_method_get_float>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| |
  29. +----------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`Variant<class_Variant>` | :ref:`get_input<class_XRController3D_method_get_input>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| |
  31. +----------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`TrackerHand<enum_XRPositionalTracker_TrackerHand>` | :ref:`get_tracker_hand<class_XRController3D_method_get_tracker_hand>`\ (\ ) |const| |
  33. +----------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`Vector2<class_Vector2>` | :ref:`get_vector2<class_XRController3D_method_get_vector2>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| |
  35. +----------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`bool<class_bool>` | :ref:`is_button_pressed<class_XRController3D_method_is_button_pressed>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| |
  37. +----------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  38. .. rst-class:: classref-section-separator
  39. ----
  40. .. rst-class:: classref-descriptions-group
  41. Signals
  42. -------
  43. .. _class_XRController3D_signal_button_pressed:
  44. .. rst-class:: classref-signal
  45. **button_pressed**\ (\ name\: :ref:`String<class_String>`\ ) :ref:`🔗<class_XRController3D_signal_button_pressed>`
  46. Emitted when a button on this controller is pressed.
  47. .. rst-class:: classref-item-separator
  48. ----
  49. .. _class_XRController3D_signal_button_released:
  50. .. rst-class:: classref-signal
  51. **button_released**\ (\ name\: :ref:`String<class_String>`\ ) :ref:`🔗<class_XRController3D_signal_button_released>`
  52. Emitted when a button on this controller is released.
  53. .. rst-class:: classref-item-separator
  54. ----
  55. .. _class_XRController3D_signal_input_float_changed:
  56. .. rst-class:: classref-signal
  57. **input_float_changed**\ (\ name\: :ref:`String<class_String>`, value\: :ref:`float<class_float>`\ ) :ref:`🔗<class_XRController3D_signal_input_float_changed>`
  58. Emitted when a trigger or similar input on this controller changes value.
  59. .. rst-class:: classref-item-separator
  60. ----
  61. .. _class_XRController3D_signal_input_vector2_changed:
  62. .. rst-class:: classref-signal
  63. **input_vector2_changed**\ (\ name\: :ref:`String<class_String>`, value\: :ref:`Vector2<class_Vector2>`\ ) :ref:`🔗<class_XRController3D_signal_input_vector2_changed>`
  64. Emitted when a thumbstick or thumbpad on this controller is moved.
  65. .. rst-class:: classref-item-separator
  66. ----
  67. .. _class_XRController3D_signal_profile_changed:
  68. .. rst-class:: classref-signal
  69. **profile_changed**\ (\ role\: :ref:`String<class_String>`\ ) :ref:`🔗<class_XRController3D_signal_profile_changed>`
  70. Emitted when the interaction profile on this controller is changed.
  71. .. rst-class:: classref-section-separator
  72. ----
  73. .. rst-class:: classref-descriptions-group
  74. Method Descriptions
  75. -------------------
  76. .. _class_XRController3D_method_get_float:
  77. .. rst-class:: classref-method
  78. :ref:`float<class_float>` **get_float**\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_XRController3D_method_get_float>`
  79. Returns a numeric value for the input with the given ``name``. This is used for triggers and grip sensors.
  80. \ **Note:** The current :ref:`XRInterface<class_XRInterface>` defines the ``name`` for each input. In the case of OpenXR, these are the names of actions in the current action set.
  81. .. rst-class:: classref-item-separator
  82. ----
  83. .. _class_XRController3D_method_get_input:
  84. .. rst-class:: classref-method
  85. :ref:`Variant<class_Variant>` **get_input**\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_XRController3D_method_get_input>`
  86. Returns a :ref:`Variant<class_Variant>` for the input with the given ``name``. This works for any input type, the variant will be typed according to the actions configuration.
  87. \ **Note:** The current :ref:`XRInterface<class_XRInterface>` defines the ``name`` for each input. In the case of OpenXR, these are the names of actions in the current action set.
  88. .. rst-class:: classref-item-separator
  89. ----
  90. .. _class_XRController3D_method_get_tracker_hand:
  91. .. rst-class:: classref-method
  92. :ref:`TrackerHand<enum_XRPositionalTracker_TrackerHand>` **get_tracker_hand**\ (\ ) |const| :ref:`🔗<class_XRController3D_method_get_tracker_hand>`
  93. Returns the hand holding this controller, if known.
  94. .. rst-class:: classref-item-separator
  95. ----
  96. .. _class_XRController3D_method_get_vector2:
  97. .. rst-class:: classref-method
  98. :ref:`Vector2<class_Vector2>` **get_vector2**\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_XRController3D_method_get_vector2>`
  99. Returns a :ref:`Vector2<class_Vector2>` for the input with the given ``name``. This is used for thumbsticks and thumbpads found on many controllers.
  100. \ **Note:** The current :ref:`XRInterface<class_XRInterface>` defines the ``name`` for each input. In the case of OpenXR, these are the names of actions in the current action set.
  101. .. rst-class:: classref-item-separator
  102. ----
  103. .. _class_XRController3D_method_is_button_pressed:
  104. .. rst-class:: classref-method
  105. :ref:`bool<class_bool>` **is_button_pressed**\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_XRController3D_method_is_button_pressed>`
  106. Returns ``true`` if the button with the given ``name`` is pressed.
  107. \ **Note:** The current :ref:`XRInterface<class_XRInterface>` defines the ``name`` for each input. In the case of OpenXR, these are the names of actions in the current action set.
  108. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  109. .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
  110. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  111. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  112. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  113. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  114. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  115. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  116. .. |void| replace:: :abbr:`void (No return value.)`