Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: marvmiller on April 15, 2011, 07:10:28 PM

Title: [solved] Get Button Down for Axis input - Up or Down? Left or Right?
Post by: marvmiller on April 15, 2011, 07:10:28 PM
I'm trying to simply determine if my Input Axis is Up/Dn or Left/Right and play the appropriate animation.  I'm using a GetButtonDown action, but it of course just takes in the ButtonName Horizontal or Vertical.  How can I tell which direction as in up or down, left or right?  Do I need to do a check for positive/negative somehow?  How?  Any examples out there?  A better approach?

thanks in advance
Title: Re: Get Button Down for Axis input - Up or Down? Left or Right?
Post by: Alex Chouls on April 15, 2011, 09:11:44 PM
You could store the offsets from Get Axis Vector and then use Float Compare: https://hutonggames.fogbugz.com/default.asp?W80

However this seems like a common enough use case that it deserves its own action.

So I posted one here: http://hutonggames.com/playmakerforum/index.php?topic=137.0

Let me know how it works for you...
Title: Re: Get Button Down for Axis input - Up or Down? Left or Right?
Post by: marvmiller on April 16, 2011, 04:13:51 PM
Wow!  I'm very impressed!  Thanks for responding so quickly! ;D
Title: Re: [solved] Get Button Down for Axis input - Up or Down? Left or Right?
Post by: jeanfabre on April 16, 2011, 04:37:40 PM
Hi,

 Excellent!

There is also a another solution when only keyboard inputs is required, simply create two inputs, one for the positive input of a given control and one for the negative input of the same control. It works very well but of course needs customization on the inputs settings themselves. You would en up with VerticalUp and VerticalDown. That saves a lot of trouble and wiring in some situations.


 Bye,

 Jean
Title: Re: [solved] Get Button Down for Axis input - Up or Down? Left or Right?
Post by: Alex Chouls on April 16, 2011, 04:44:48 PM
Nice solution! I forget sometimes how flexible the Unity Input Manager is...
Title: Re: [solved] Get Button Down for Axis input - Up or Down? Left or Right?
Post by: jeanfabre on April 16, 2011, 04:55:14 PM
Hi Alex,

 Yes, and at the same time so impractical cause we have no access to the input settings via code, and only standalone offers a very limited/not-for-real-world-project user editing ability. A real pity, and I fear Unity is never going to do anything on that matter. Too bad really...

Bye,

 Jean