diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-11-16 09:30:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-16 09:30:34 +0100 |
commit | 19f27ab4862d65afd357c5f739ab40df64c94185 (patch) | |
tree | dc10f892fb0fa692ba0456f66fa2984d52bb3ad0 /doc | |
parent | a6150eb2678f32b1e07550a81097d6973fc7ad5d (diff) | |
parent | 4abf189e367b5b5f9846fd9dd3a3cade69e28505 (diff) |
Merge pull request #42976 from aaronfranke/input-get-axis
Allow getting Input "axis" and "vector" values by specifying multiple actions
Diffstat (limited to 'doc')
-rw-r--r-- | doc/classes/Input.xml | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml index fb0ed8ff62..eafae7310c 100644 --- a/doc/classes/Input.xml +++ b/doc/classes/Input.xml @@ -54,6 +54,15 @@ [b]Note:[/b] This method only works on iOS, Android, and UWP. On other platforms, it always returns [constant Vector3.ZERO]. </description> </method> + <method name="get_action_raw_strength" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="action" type="StringName"> + </argument> + <description> + Returns a value between 0 and 1 representing the raw intensity of the given action, ignoring the action's deadzone. In most cases, you should use [method get_action_strength] instead. + </description> + </method> <method name="get_action_strength" qualifiers="const"> <return type="float"> </return> @@ -63,6 +72,18 @@ Returns a value between 0 and 1 representing the intensity of the given action. In a joypad, for example, the further away the axis (analog sticks or L2, R2 triggers) is from the dead zone, the closer the value will be to 1. If the action is mapped to a control that has no axis as the keyboard, the value returned will be 0 or 1. </description> </method> + <method name="get_axis" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="negative_action" type="StringName"> + </argument> + <argument index="1" name="positive_action" type="StringName"> + </argument> + <description> + Get axis input by specifying two actions, one negative and one positive. + This is a horthand for writing [code]Input.get_action_strength("positive_action") - Input.get_action_strength("negative_action")[/code]. + </description> + </method> <method name="get_connected_joypads"> <return type="Array"> </return> @@ -205,6 +226,25 @@ Returns the mouse mode. See the constants for more information. </description> </method> + <method name="get_vector" qualifiers="const"> + <return type="Vector2"> + </return> + <argument index="0" name="negative_x" type="StringName"> + </argument> + <argument index="1" name="positive_x" type="StringName"> + </argument> + <argument index="2" name="negative_y" type="StringName"> + </argument> + <argument index="3" name="positive_y" type="StringName"> + </argument> + <argument index="4" name="deadzone" type="float" default="-1.0"> + </argument> + <description> + Get vector input by specifying four actions, two for the X axis and two for the Y axis, negative and positive. + This method is useful when getting vector input, such as from a joystick, directional pad, arrows, or WASD. The vector has its length limited to 1 and has a circular deadzone, which is useful for using vector input as movement. + By default, the deadzone is automatically calculated from the average of the action deadzones. However, you can override the deadzone to be whatever you want (on the range of 0 to 1). + </description> + </method> <method name="is_action_just_pressed" qualifiers="const"> <return type="bool"> </return> |