• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

[SOLVED] Gamepad axis value doesn't feel right

Bentley

Member
So I've been tinkering with my xbox controller and the axes, and the values just don't feel right.

Ex: I hold the stick up-right (at least it seems to be up-right).
gamepad_axis_value(horizontal) is high, like 0.7.
but...
gamepad_axis_value(vertical) is very low, like 0.01.

I hoped it would be something close to 0.5, 0.5. Now it may be that what I think is up-right is not up-right. But I think a player would feel the same way I do: "I held up-right so the bullet should go in that direction" kind of thing.

Does anyone have any experience working with gamepad axes? Any advice / links would be appreciated.
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
Are you sure that you are polling the same stick for vertical coordinate? Showing the exact code helps.
 

Bentley

Member
Are you sure that you are polling the same stick for vertical coordinate? Showing the exact code helps.
Thx for the reply. Here's the code:
Code:
var xaxis = gamepad_axis_value(0, gp_axisrh);
var yaxis = gamepad_axis_value(0, gp_axisrv);

if (keyboard_check_pressed(vk_enter))
{
    test = true;
    timer = room_speed;
}

if (test && timer <= 0)
{
    show_debug_message("xaxis: " + string(xaxis));
    show_debug_message("yaxis: " + string(yaxis));
    test = false;
}

timer--;
The only reason I'm using press_enter and then giving myself a 1 second timer is to get the axis in position. I assumed that if I took it immediately I'd get a small value (as it's in deadzone at start and takes a few frames to get extended).

The axis does work. For ex: if I move it in circles an instance would move in circles using point_direction(0, 0, horz_value, vert_value) and lengthdir_x/y. But that works well when the stick is held to its max. I want to get accurate stick input for "quick axis movements" (for lack of the right phrase). Like if I move the stick up right real fast, halfway, the xinput yinput seems weird. But again, it may just be me.
 
Last edited:

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
Thx for the reply. Here's the code:
Code:
var xaxis = gamepad_axis_value(0, gp_axisrh);
var yaxis = gamepad_axis_value(0, gp_axisrv);

if (keyboard_check_pressed(vk_enter))
{
    test = true;
    timer = room_speed;
}

if (test && timer <= 0)
{
    show_debug_message("xaxis: " + string(xaxis));
    show_debug_message("yaxis: " + string(yaxis));
    test = false;
}

timer--;
The only reason I'm using press_enter and then giving myself a 1 second timer is to get the axis in position. I assumed that if I took it immediately I'd get a small value (as it's in deadzone at start and takes a few frames to get extended).

The axis does work. For ex: if I move it in circles an instance would move in circles using point_direction(0, 0, horz_value, vert_value) and lengthdir_x/y. But that works well when the stick is held to its max. I want to get accurate stick input for "quick axis movements" (for lack of the right phrase). Like if I move the stick up right real fast, halfway, the xinput yinput seems weird. But again, it may just be me.
That does work as expected for me. You could try drawing the value of each axis on screen in a draw event - that should make it easier to tell what's going on
 

tagwolf

Member
So I've been tinkering with my xbox controller and the axes, and the values just don't feel right.

Ex: I hold the stick up-right (at least it seems to be up-right).
gamepad_axis_value(horizontal) is high, like 0.7.
but...
gamepad_axis_value(vertical) is very low, like 0.01.

I hoped it would be something close to 0.5, 0.5. Now it may be that what I think is up-right is not up-right. But I think a player would feel the same way I do: "I held up-right so the bullet should go in that direction" kind of thing.

Does anyone have any experience working with gamepad axes? Any advice / links would be appreciated.
Don't forget to setup deadzones. So many people forget to set deadzones >.<
 
Top