playMaker

Author Topic: [solved] Get Button Down for Axis input - Up or Down? Left or Right?  (Read 13747 times)

marvmiller

  • Playmaker Newbie
  • *
  • Posts: 14
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
« Last Edit: April 16, 2011, 04:14:23 PM by marvmiller »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Get Button Down for Axis input - Up or Down? Left or Right?
« Reply #1 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...
« Last Edit: April 15, 2011, 09:15:12 PM by alexchouls »

marvmiller

  • Playmaker Newbie
  • *
  • Posts: 14
Re: Get Button Down for Axis input - Up or Down? Left or Right?
« Reply #2 on: April 16, 2011, 04:13:51 PM »
Wow!  I'm very impressed!  Thanks for responding so quickly! ;D

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: [solved] Get Button Down for Axis input - Up or Down? Left or Right?
« Reply #3 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

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: [solved] Get Button Down for Axis input - Up or Down? Left or Right?
« Reply #4 on: April 16, 2011, 04:44:48 PM »
Nice solution! I forget sometimes how flexible the Unity Input Manager is...

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: [solved] Get Button Down for Axis input - Up or Down? Left or Right?
« Reply #5 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