2017-09-13 04:42:36 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-07-06 16:08:05 +08:00
<class name= "XRController3D" inherits= "XRNode3D" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2017-09-13 04:42:36 +08:00
<brief_description >
2019-06-22 07:04:47 +08:00
A spatial node representing a spatially-tracked controller.
2017-09-13 04:42:36 +08:00
</brief_description>
<description >
2019-01-16 16:44:35 +08:00
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.
2020-04-08 22:47:36 +08:00
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.
The position of the controller node is automatically updated by the [XRServer]. This makes this node ideal to add child nodes to visualize the controller.
2021-08-29 14:05:11 +08:00
As many XR runtimes now use a configurable action map all inputs are named.
2017-09-13 04:42:36 +08:00
</description>
<tutorials >
2022-07-22 20:05:31 +08:00
<link title= "XR documentation index" > $DOCS_URL/tutorials/xr/index.html</link>
2017-09-13 04:42:36 +08:00
</tutorials>
<methods >
2023-01-22 10:17:20 +08:00
<method name= "get_float" qualifiers= "const" >
<return type= "float" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "name" type= "StringName" />
2017-09-13 04:42:36 +08:00
<description >
2023-01-22 10:17:20 +08:00
Returns a numeric value for the input with the given [param name]. This is used for triggers and grip sensors.
</description>
</method>
<method name= "get_input" qualifiers= "const" >
<return type= "Variant" />
<param index= "0" name= "name" type= "StringName" />
<description >
Returns a [Variant] for the input with the given [param name]. This works for any input type, the variant will be typed according to the actions configuration.
2017-09-13 04:42:36 +08:00
</description>
</method>
2021-08-29 14:05:11 +08:00
<method name= "get_tracker_hand" qualifiers= "const" >
<return type= "int" enum= "XRPositionalTracker.TrackerHand" />
2017-09-13 04:42:36 +08:00
<description >
2021-08-29 14:05:11 +08:00
Returns the hand holding this controller, if known. See [enum XRPositionalTracker.TrackerHand].
2017-09-13 04:42:36 +08:00
</description>
</method>
2023-01-22 10:17:20 +08:00
<method name= "get_vector2" qualifiers= "const" >
<return type= "Vector2" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "name" type= "StringName" />
2019-02-05 18:02:13 +08:00
<description >
2023-01-22 10:17:20 +08:00
Returns a [Vector2] for the input with the given [param name]. This is used for thumbsticks and thumbpads found on many controllers.
2021-01-04 21:33:44 +08:00
</description>
</method>
2017-09-13 04:42:36 +08:00
<method name= "is_button_pressed" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "bool" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "name" type= "StringName" />
2017-09-13 04:42:36 +08:00
<description >
2022-08-09 07:41:07 +08:00
Returns [code]true[/code] if the button with the given [param name] is pressed.
2017-09-13 04:42:36 +08:00
</description>
2017-11-13 16:24:36 +08:00
</method>
2017-09-13 04:42:36 +08:00
</methods>
<signals >
<signal name= "button_pressed" >
2022-08-07 02:11:48 +08:00
<param index= "0" name= "name" type= "String" />
2017-09-13 04:42:36 +08:00
<description >
2017-12-07 14:16:27 +08:00
Emitted when a button on this controller is pressed.
2017-09-13 04:42:36 +08:00
</description>
</signal>
2020-12-08 16:37:48 +08:00
<signal name= "button_released" >
2022-08-07 02:11:48 +08:00
<param index= "0" name= "name" type= "String" />
2017-09-13 04:42:36 +08:00
<description >
2017-12-07 14:16:27 +08:00
Emitted when a button on this controller is released.
2017-09-13 04:42:36 +08:00
</description>
</signal>
2023-01-22 10:17:20 +08:00
<signal name= "input_float_changed" >
2022-08-07 02:11:48 +08:00
<param index= "0" name= "name" type= "String" />
2023-01-22 10:17:20 +08:00
<param index= "1" name= "value" type= "float" />
2021-08-29 14:05:11 +08:00
<description >
2023-01-22 10:17:20 +08:00
Emitted when a trigger or similar input on this controller changes value.
2021-08-29 14:05:11 +08:00
</description>
</signal>
2023-01-22 10:17:20 +08:00
<signal name= "input_vector2_changed" >
2022-08-07 02:11:48 +08:00
<param index= "0" name= "name" type= "String" />
2023-01-22 10:17:20 +08:00
<param index= "1" name= "value" type= "Vector2" />
2019-02-05 18:02:13 +08:00
<description >
2023-01-22 10:17:20 +08:00
Emitted when a thumbstick or thumbpad on this controller is moved.
2019-02-05 18:02:13 +08:00
</description>
</signal>
2024-03-06 22:43:19 +08:00
<signal name= "profile_changed" >
<param index= "0" name= "role" type= "String" />
<description >
Emitted when the interaction profile on this controller is changed.
</description>
</signal>
2017-09-13 04:42:36 +08:00
</signals>
</class>