How do I increase the dead zone for gamepad joystick?

0 favourites
  • 6 posts
From the Asset Store
A smart joystick plugin, perfect for all mobile games.
  • Yo people,

    I want to increase the dead zone on the gamepad joystick.

    I have my joystick set up in degrees of a circle also, not the -100 to 100 values for each axis. I'm using this to get my angles: (angle(0,0,Gamepad.Axis(0,0),Gamepad.Axis(0,1))%360+360)%360

    And I get joystick inputs by things like: x>0, x<100 perform action .......etc

    As it stands now, the tiniest movement of the joystick registers an input. I want it to only register if the joystick is pressed fully up against the edge, or at least 90% of the way. Any help would be much appreciated, thanks

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You might be able to apply the joystick input value to an instance variable and base conditions on that instance variable.

    i.e :

    every tick set value of instance variable to the according axis for "joystick input"

    if value equals "90% of the way" set action

    • or -

    [y >= instance variable perform action]

    set value of instance variable to match the axis value of the gamepad when pressed fully up "90% of the way".

  • And I get joystick inputs by things like: x>0, x<100 perform action .......etc

    Just change that 0 in all of your events to whatever value you want. 80, 90, whatever. It might help to make it reference a variable then you can just keep adjusting the variable to increase/decrease your deadzone.

    So if X>80,X<100 and if X<-80,X>-100 etc. but swap 80 out for a variable so you can change it later really easily.

  • EyezWidee

    I think I understand what you're saying. I'll give it a shot. Thanks

    C-7

    for x>0,x<100 those are degrees of the circle. (My fault, bad example using 0 and 100 for the values) For example, if the joystick is between 0 degrees and 100 degrees then set action.

  • Use both then. Still keep track of your degrees and just add the dead zone conditions simultaneously. That way, it only triggers at the edges of the circle pad, but when it does, you keep track of the degrees.

  • C-7

    I understand the theory. Have it measure the degrees, and only trigger if it outside of my desired dead zone.

    How would I add the dead zone conditions?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)