2017-09-12 22:42:36 +02:00
<?xml version="1.0" encoding="UTF-8" ?>
2021-08-29 08:05:11 +02:00
<class name= "XRController3D" inherits= "XRNode3D" version= "4.0" >
2017-09-12 22:42:36 +02:00
<brief_description >
2019-06-22 01:04:47 +02:00
A spatial node representing a spatially-tracked controller.
2017-09-12 22:42:36 +02:00
</brief_description>
<description >
2019-01-16 09:44:35 +01: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 16:47:36 +02: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 08:05:11 +02:00
As many XR runtimes now use a configurable action map all inputs are named.
2017-09-12 22:42:36 +02:00
</description>
<tutorials >
2021-10-06 13:48:48 +02:00
<link title= "VR documentation index" > https://docs.godotengine.org/en/latest/tutorials/vr/index.html</link>
2017-09-12 22:42:36 +02:00
</tutorials>
<methods >
2021-08-29 08:05:11 +02:00
<method name= "get_axis" qualifiers= "const" >
<return type= "Vector2" />
<argument index= "0" name= "name" type= "StringName" />
2017-09-12 22:42:36 +02:00
<description >
2021-08-29 08:05:11 +02:00
Returns a [Vector2] for the input with the given [code]name[/code]. This is used for thumbsticks and thumbpads found on many controllers.
2017-09-12 22:42:36 +02:00
</description>
</method>
2021-08-29 08:05:11 +02:00
<method name= "get_tracker_hand" qualifiers= "const" >
<return type= "int" enum= "XRPositionalTracker.TrackerHand" />
2017-09-12 22:42:36 +02:00
<description >
2021-08-29 08:05:11 +02:00
Returns the hand holding this controller, if known. See [enum XRPositionalTracker.TrackerHand].
2017-09-12 22:42:36 +02:00
</description>
</method>
2021-08-29 08:05:11 +02:00
<method name= "get_value" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "float" />
2021-08-29 08:05:11 +02:00
<argument index= "0" name= "name" type= "StringName" />
2019-02-05 11:02:13 +01:00
<description >
2021-08-29 08:05:11 +02:00
Returns a numeric value for the input with the given [code]name[/code]. This is used for triggers and grip sensors.
2021-01-04 14:33:44 +01:00
</description>
</method>
2017-09-12 22:42:36 +02:00
<method name= "is_button_pressed" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "bool" />
2021-08-29 08:05:11 +02:00
<argument index= "0" name= "name" type= "StringName" />
2017-09-12 22:42:36 +02:00
<description >
2021-08-29 08:05:11 +02:00
Returns [code]true[/code] if the button with the given [code]name[/code] is pressed.
2017-09-12 22:42:36 +02:00
</description>
2017-11-13 09:24:36 +01:00
</method>
2017-09-12 22:42:36 +02:00
</methods>
<members >
2019-06-29 12:38:01 +02:00
<member name= "rumble" type= "float" setter= "set_rumble" getter= "get_rumble" default= "0.0" >
2020-04-08 16:47:36 +02:00
The degree to which the controller vibrates. Ranges from [code]0.0[/code] to [code]1.0[/code] with precision [code].01[/code]. If changed, updates [member XRPositionalTracker.rumble] accordingly.
2019-12-05 22:58:58 +01:00
This is a useful property to animate if you want the controller to vibrate for a limited duration.
2017-12-07 08:23:08 +01:00
</member>
2017-09-12 22:42:36 +02:00
</members>
<signals >
<signal name= "button_pressed" >
2021-08-29 08:05:11 +02:00
<argument index= "0" name= "name" type= "String" />
2017-09-12 22:42:36 +02:00
<description >
2017-12-07 07:16:27 +01:00
Emitted when a button on this controller is pressed.
2017-09-12 22:42:36 +02:00
</description>
</signal>
2020-12-08 09:37:48 +01:00
<signal name= "button_released" >
2021-08-29 08:05:11 +02:00
<argument index= "0" name= "name" type= "String" />
2017-09-12 22:42:36 +02:00
<description >
2017-12-07 07:16:27 +01:00
Emitted when a button on this controller is released.
2017-09-12 22:42:36 +02:00
</description>
</signal>
2021-08-29 08:05:11 +02:00
<signal name= "input_axis_changed" >
<argument index= "0" name= "name" type= "String" />
<argument index= "1" name= "value" type= "Vector2" />
<description >
Emitted when a thumbstick or thumbpad on this controller is moved.
</description>
</signal>
<signal name= "input_value_changed" >
<argument index= "0" name= "name" type= "String" />
<argument index= "1" name= "value" type= "float" />
2019-02-05 11:02:13 +01:00
<description >
2021-08-29 08:05:11 +02:00
Emitted when a trigger or similar input on this controller changes value.
2019-02-05 11:02:13 +01:00
</description>
</signal>
2017-09-12 22:42:36 +02:00
</signals>
</class>