class_arvrcontroller.rst 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the ARVRController.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_ARVRController:
  5. ARVRController
  6. ==============
  7. **Inherits:** :ref:`Spatial<class_Spatial>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. A spatial node representing a spatially-tracked controller.
  12. Properties
  13. ----------
  14. +---------------------------+-------------------------------------------------------------------+-----+
  15. | :ref:`int<class_int>` | :ref:`controller_id<class_ARVRController_property_controller_id>` | 1 |
  16. +---------------------------+-------------------------------------------------------------------+-----+
  17. | :ref:`float<class_float>` | :ref:`rumble<class_ARVRController_property_rumble>` | 0.0 |
  18. +---------------------------+-------------------------------------------------------------------+-----+
  19. Methods
  20. -------
  21. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`String<class_String>` | :ref:`get_controller_name<class_ARVRController_method_get_controller_name>` **(** **)** const |
  23. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`TrackerHand<enum_ARVRPositionalTracker_TrackerHand>` | :ref:`get_hand<class_ARVRController_method_get_hand>` **(** **)** const |
  25. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`bool<class_bool>` | :ref:`get_is_active<class_ARVRController_method_get_is_active>` **(** **)** const |
  27. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`float<class_float>` | :ref:`get_joystick_axis<class_ARVRController_method_get_joystick_axis>` **(** :ref:`int<class_int>` axis **)** const |
  29. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`int<class_int>` | :ref:`get_joystick_id<class_ARVRController_method_get_joystick_id>` **(** **)** const |
  31. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`Mesh<class_Mesh>` | :ref:`get_mesh<class_ARVRController_method_get_mesh>` **(** **)** const |
  33. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`int<class_int>` | :ref:`is_button_pressed<class_ARVRController_method_is_button_pressed>` **(** :ref:`int<class_int>` button **)** const |
  35. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
  36. Signals
  37. -------
  38. .. _class_ARVRController_signal_button_pressed:
  39. - **button_pressed** **(** :ref:`int<class_int>` button **)**
  40. Emitted when a button on this controller is pressed.
  41. .. _class_ARVRController_signal_button_release:
  42. - **button_release** **(** :ref:`int<class_int>` button **)**
  43. Emitted when a button on this controller is released.
  44. .. _class_ARVRController_signal_mesh_updated:
  45. - **mesh_updated** **(** :ref:`Mesh<class_Mesh>` mesh **)**
  46. Emitted when the mesh associated with the controller changes or when one becomes available. Generally speaking this will be a static mesh after becoming available.
  47. Description
  48. -----------
  49. This is a helper spatial 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.
  50. 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 ARVRController nodes to your scene.
  51. The position of the controller node is automatically updated by the :ref:`ARVRServer<class_ARVRServer>`. This makes this node ideal to add child nodes to visualize the controller.
  52. Property Descriptions
  53. ---------------------
  54. .. _class_ARVRController_property_controller_id:
  55. - :ref:`int<class_int>` **controller_id**
  56. +-----------+--------------------------+
  57. | *Default* | 1 |
  58. +-----------+--------------------------+
  59. | *Setter* | set_controller_id(value) |
  60. +-----------+--------------------------+
  61. | *Getter* | get_controller_id() |
  62. +-----------+--------------------------+
  63. The controller's ID.
  64. A controller ID of 0 is unbound and will always result in an inactive node. Controller ID 1 is reserved for the first controller that identifies itself as the left-hand controller and ID 2 is reserved for the first controller that identifies itself as the right-hand controller.
  65. For any other controller that the :ref:`ARVRServer<class_ARVRServer>` detects, we continue with controller ID 3.
  66. When a controller is turned off, its slot is freed. This ensures controllers will keep the same ID even when controllers with lower IDs are turned off.
  67. .. _class_ARVRController_property_rumble:
  68. - :ref:`float<class_float>` **rumble**
  69. +-----------+-------------------+
  70. | *Default* | 0.0 |
  71. +-----------+-------------------+
  72. | *Setter* | set_rumble(value) |
  73. +-----------+-------------------+
  74. | *Getter* | get_rumble() |
  75. +-----------+-------------------+
  76. The degree to which the tracker rumbles. Ranges from ``0.0`` to ``1.0`` with precision ``.01``. If changed, updates :ref:`ARVRPositionalTracker.rumble<class_ARVRPositionalTracker_property_rumble>` accordingly.
  77. Method Descriptions
  78. -------------------
  79. .. _class_ARVRController_method_get_controller_name:
  80. - :ref:`String<class_String>` **get_controller_name** **(** **)** const
  81. If active, returns the name of the associated controller if provided by the AR/VR SDK used.
  82. .. _class_ARVRController_method_get_hand:
  83. - :ref:`TrackerHand<enum_ARVRPositionalTracker_TrackerHand>` **get_hand** **(** **)** const
  84. Returns the hand holding this controller, if known. See ``TRACKER_*`` constants in :ref:`ARVRPositionalTracker<class_ARVRPositionalTracker>`.
  85. .. _class_ARVRController_method_get_is_active:
  86. - :ref:`bool<class_bool>` **get_is_active** **(** **)** const
  87. Returns ``true`` if the bound controller is active. ARVR systems attempt to track active controllers.
  88. .. _class_ARVRController_method_get_joystick_axis:
  89. - :ref:`float<class_float>` **get_joystick_axis** **(** :ref:`int<class_int>` axis **)** const
  90. Returns the value of the given axis for things like triggers, touchpads, etc. that are embedded into the controller.
  91. .. _class_ARVRController_method_get_joystick_id:
  92. - :ref:`int<class_int>` **get_joystick_id** **(** **)** const
  93. Returns the ID of the joystick object bound to this. Every controller tracked by the :ref:`ARVRServer<class_ARVRServer>` that has buttons and axis will also be registered as a joystick within Godot. This means that all the normal joystick tracking and input mapping will work for buttons and axis found on the AR/VR controllers. This ID is purely offered as information so you can link up the controller with its joystick entry.
  94. .. _class_ARVRController_method_get_mesh:
  95. - :ref:`Mesh<class_Mesh>` **get_mesh** **(** **)** const
  96. If provided by the :ref:`ARVRInterface<class_ARVRInterface>`, this returns a mesh associated with the controller. This can be used to visualize the controller.
  97. .. _class_ARVRController_method_is_button_pressed:
  98. - :ref:`int<class_int>` **is_button_pressed** **(** :ref:`int<class_int>` button **)** const
  99. Returns ``true`` if the button at index ``button`` is pressed.