Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: joshua121 on May 15, 2015, 07:37:03 AM

Title: Get Button Down trigger From Joystick axis
Post by: joshua121 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.
Title: Re: Get Button Down trigger From Joystick axis
Post by: redikann 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.
Title: Re: Get Button Down trigger From Joystick axis
Post by: joshua121 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.
Title: Re: Get Button Down trigger From Joystick axis
Post by: Chris Vitorino 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