ARVRController.xml 5.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="ARVRController" inherits="Spatial" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
  3. <brief_description>
  4. A spatial node representing a spatially-tracked controller.
  5. </brief_description>
  6. <description>
  7. 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.
  8. 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.
  9. The position of the controller node is automatically updated by the [ARVRServer]. This makes this node ideal to add child nodes to visualize the controller.
  10. </description>
  11. <tutorials>
  12. <link>$DOCS_URL/tutorials/vr/index.html</link>
  13. </tutorials>
  14. <methods>
  15. <method name="get_controller_name" qualifiers="const">
  16. <return type="String" />
  17. <description>
  18. If active, returns the name of the associated controller if provided by the AR/VR SDK used.
  19. </description>
  20. </method>
  21. <method name="get_hand" qualifiers="const">
  22. <return type="int" enum="ARVRPositionalTracker.TrackerHand" />
  23. <description>
  24. Returns the hand holding this controller, if known. See [enum ARVRPositionalTracker.TrackerHand].
  25. </description>
  26. </method>
  27. <method name="get_is_active" qualifiers="const">
  28. <return type="bool" />
  29. <description>
  30. Returns [code]true[/code] if the bound controller is active. ARVR systems attempt to track active controllers.
  31. </description>
  32. </method>
  33. <method name="get_joystick_axis" qualifiers="const">
  34. <return type="float" />
  35. <argument index="0" name="axis" type="int" />
  36. <description>
  37. Returns the value of the given axis for things like triggers, touchpads, etc. that are embedded into the controller.
  38. </description>
  39. </method>
  40. <method name="get_joystick_id" qualifiers="const">
  41. <return type="int" />
  42. <description>
  43. Returns the ID of the joystick object bound to this. Every controller tracked by the [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.
  44. </description>
  45. </method>
  46. <method name="get_mesh" qualifiers="const">
  47. <return type="Mesh" />
  48. <description>
  49. If provided by the [ARVRInterface], this returns a mesh associated with the controller. This can be used to visualize the controller.
  50. </description>
  51. </method>
  52. <method name="is_button_pressed" qualifiers="const">
  53. <return type="int" />
  54. <argument index="0" name="button" type="int" />
  55. <description>
  56. Returns [code]true[/code] if the button at index [code]button[/code] is pressed. See [enum JoystickList], in particular the [code]JOY_VR_*[/code] constants.
  57. </description>
  58. </method>
  59. </methods>
  60. <members>
  61. <member name="controller_id" type="int" setter="set_controller_id" getter="get_controller_id" default="1">
  62. The controller's ID.
  63. 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.
  64. For any other controller that the [ARVRServer] detects, we continue with controller ID 3.
  65. 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.
  66. </member>
  67. <member name="rumble" type="float" setter="set_rumble" getter="get_rumble" default="0.0">
  68. The degree to which the controller vibrates. Ranges from [code]0.0[/code] to [code]1.0[/code]. If changed, updates [member ARVRPositionalTracker.rumble] accordingly.
  69. This is a useful property to animate if you want the controller to vibrate for a limited duration.
  70. </member>
  71. </members>
  72. <signals>
  73. <signal name="button_pressed">
  74. <argument index="0" name="button" type="int" />
  75. <description>
  76. Emitted when a button on this controller is pressed.
  77. </description>
  78. </signal>
  79. <signal name="button_release">
  80. <argument index="0" name="button" type="int" />
  81. <description>
  82. Emitted when a button on this controller is released.
  83. </description>
  84. </signal>
  85. <signal name="mesh_updated">
  86. <argument index="0" name="mesh" type="Mesh" />
  87. <description>
  88. 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.
  89. </description>
  90. </signal>
  91. </signals>
  92. <constants>
  93. </constants>
  94. </class>