playMaker

Author Topic: Get Button Down trigger From Joystick axis  (Read 7669 times)

joshua121

  • Playmaker Newbie
  • *
  • Posts: 6
Get Button Down trigger From Joystick axis
« on: May 15, 2015, 07:37:03 AM »
I'm trying to setup a double tap to sprint control for my character, (where one would press forward twice quickly to enable sprint) and it works fine with the keyboard. However it doesn't seem to work for the joystick axis input and I'm not sure how to go about getting an event trigger from the joystick axis.

I tried the Axis Event action but it seems to send events every frame which doesn't allow me to find out if the player has double tapped the joystick, it just keeps firing the event and shoots right into the sprint action.

My layout is like this...

State 1
Get Button Down
    Horizontal Input
        Send Event Moving


State 2
Get Button Down
    Horizontal Input
        Send Event Sprinting

 or

Wait .5 seconds send finished event back to state 1


State 3
Send event to the sprint controller.

******************************

Like I said the FSM works great with the keyboard but I think that's because the A/D Left Arrow/ Right Arrow function as buttons while the joystick works off of a float. So I just can't seem to wrap my head around how to do this with a simple solution.

Suggestions and help in solving this issue would be greatly appreciated.
« Last Edit: May 19, 2015, 08:15:54 AM by joshua121 »

redikann

  • Full Member
  • ***
  • Posts: 174
Re: Get Button Down trigger From Joystick axis
« Reply #1 on: May 16, 2015, 08:13:52 PM »
Axis click (aka Right Stick or LS) is a button , not axis input. Either look for it as a key code (joystick0 button8) or create a virtual button thru the Unity input editor.
« Last Edit: May 16, 2015, 08:17:35 PM by redikann »

joshua121

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Get Button Down trigger From Joystick axis
« Reply #2 on: May 19, 2015, 08:14:52 AM »
Axis click (aka Right Stick or LS) is a button , not axis input. Either look for it as a key code (joystick0 button8) or create a virtual button thru the Unity input editor.

Thank you for your reply, however I am not looking to use the axis click function.

Maybe I was not clear enough in my original post. What I'm looking to do is press left or right twice on the joystick in quick succession to start sprinting.

However when I try to get an axis event from that it fires every frame if the axis is held, thus I don't know how to make what I'm trying to do happen.

The axis input works in an entirely different fashion from the buttons. I understand how to use the buttons for functions like this, but the axis is beyond me at the moment.

Chris Vitorino

  • Playmaker Newbie
  • *
  • Posts: 14
Re: Get Button Down trigger From Joystick axis
« Reply #3 on: August 21, 2015, 12:17:07 AM »
I had the exact same problem. I've found a solution for it, posted it here: http://hutonggames.com/playmakerforum/index.php?topic=10997.0