This post has 2 parts. The first is a step by step chronology of what I did. The second is an analysis, thoughts and questions.
Part 1:
I wanted to test every gamepad events to be sure I understand them all. The gamepad I used is a 3 days old brand new wired Afterglow, which is an Xbox 360 clone.
I started by using the 30 available gamepad events so every one of them fire a “Print String” node that write the name of the event on the screen when I press its corresponding button.
Here is how it looks like.
&stc=1As I said, I did these tests to learn how the gamepad events work. So the first thing I learned is that all the events that return an “Axis Value” (I will call them the analog events for the rest of the post) always fire, even when their corresponding buttons are not touched on the gamepad. The result is that my code was a bit useless since every time I pressed a button, its text was immediately flushed away by the text from the always firing analog events.
I noticed that all the analog events have their digital counterparts as seen on this picture.
&stc=1To fix my problem, I used “Gate” nodes, where the digital events open and close the gates for the analog events. Here is an example:
&stc=1I also changed the text color (not shown on the picture) associated with the analog events so it’s easier to differentiate the digital and analog events. The output log (Window / Output Log) was also helpful.
The first button I tried was the Left Trigger. The logic of the code worked perfectly, no more useless wall of text on screen. I pressed very slowly to catch the first value it would write on screen when the digital event opens the gate for the analog event. To avoid that the value gets flushed away (because now that the button is pressed, it writes the value every frame), I just had to release the button. That first value was 0.121569.
I felt like it was wrong. The analog event nodes return values ranging from 0 to 1 (or 0 to -1). 0.121569 is 12% of the maximum value, and I got it as the very first value. It seemed to me that I was losing precision on the lowest values. So I investigated further.
I wanted to see what was the very first value the analog event could give me, but to do so I couldn’t use its digital counterpart anymore to control the gate since the problem might be that the digital event fires too late (thus it would open the gate much later than the analog event gives its first non-zero value).
So I used a random button (“Gamepad Face Button Left” event) to control the gate. That way, I got a wall of text only while that button was pressed. So I pressed it, having a wall of text saying “0.0”, again very slowly moved the Left Trigger until I saw the first none “0.0” value and then released the “Gamepad Face Button Left”. That first value was 0.007843.
That made much more sense to me. But I needed to push my knowledge further, so I tested every of the 6 analog events to know both their very first value (using a random button to control the gate) and the value at which their digital counterpart fires (using the said counterpart to control the gate).
Here are the values I got.
[TABLE=“class: grid, width: 500”]
Smallest (none zero) possible value
Digital counterpart fires at value
Left Trigger event
0.007843
0.121569
Right Trigger event
0.007843
0.121569
[TABLE=“class: grid, width: 500”]
Smallest (none zero) possible value
Digital counterpart fires at value
Moving Right
Moving Left
Moving Right
Moving Left
Left X event
0.002777
-0.001506
0.0[SUP]1[/SUP]
0.0[SUP]2[/SUP]
Right X event
0.002085
-0.001506
0.021821
-0.021281
[TABLE=“class: grid, width: 500”]
Smallest (none zero) possible value
Digital counterpart fires at value
Moving Up
Moving Down
Moving Up
Moving Down
Left Y event
0.001475
-0.001383
0.0[SUP]1[/SUP]
0.0[SUP]1[/SUP]
Right Y event
-0.002208
0.001424
-0.022797
0.021118
I used values with all the float precision to fill the tables because they are the exact numbers I got on every tries. I was actually surprised to observe such repeatable precision, but I was also happy with it because I like things that are predictable.
[SUP]1 [/SUP]The first none zero value came very closely after the digital event fired.
[SUP]2 [/SUP]After the digital event fired, there was still a little bit of space before the analog event reached its first none zero value.
Part 2:
Analyzing the tables:
- The left and right triggers both react exactly the same, and fire their digital events at 12%.
- The Left analog stick fires its 4 digital events before its 2 analog events return their first none zero value.
- The Right analog stick does the opposite.
- In both cases the digital and analog events fire close enough to each other.
My thoughts:
The digital events from the 2 sticks might fire close enough to their analog events, but I would still be expecting that they all start at the same %, or exactly at the very first none zero value. This should also apply to the trigger events.
Question:
Is there any reason why the 2 trigger buttons digital events react at 12% and not close to 0% like the other analog buttons?
Note that I didn’t do any test with the Release pins to see where they fire.
This is my first post, I hope I set it up all right.
I’m not English, sorry if I do not always sound right.