You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: collections/_article/handling-axis-godot.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ Up to now, actions were just binary. This means they could be either pressed or
30
30
31
31
The examples above show how limited gamepad mapping is: When using an analog axis, a bit more information than just "pressed" or "not pressed" is needed. These kind of APIs allow reading analog values, which map directly to how much the physical controller is bent on a given direction.
32
32
33
-
##Adding analog values to actions
33
+
##Adding analog values to actions
34
34
35
35
After many months of discussion on Github, and almost going with a scheme more similar to other engines, we finally settled on a simpler solution: An analog value was added to every action (along with the existing boolean one).
36
36
@@ -58,7 +58,8 @@ To map a single axis, the input mapping system will require two different action
58
58
```
59
59
var horizontal = Input.get_action_strength("right") - Input.get_action_strength("left")
60
60
```
61
-
## Deadzones
61
+
62
+
## Deadzones
62
63
63
64
Sometimes, when using analog axes, a threshold is required for activating an action. When moving a character left of right, this threshold is usually small. When moving through UI menu options a larger one is desired.
64
65
@@ -68,10 +69,9 @@ The relationship between *deadzone*, *strength* and *pressed* parameters is bett
Some modern devices also have analog face buttons (the strength of how much they are pressed is recorded), this system also covers this use case perfectly (InputEventButton still needs to implement this feature though).
73
73
74
-
##Advantages of the *strength* system
74
+
##Advantages of the *strength* system
75
75
76
76
In other game engines, analog input is handled via "axis mapping" systems. These systems allow defining a set of named axes (like "horizontal_motion"), and map them to actual analog axes from joypads.
0 commit comments