PlayMaker Help & Tips > PlayMaker Help

[solved] Get Button Down for Axis input - Up or Down? Left or Right?

(1/2) > >>

marvmiller:
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

Alex Chouls:
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...

marvmiller:
Wow!  I'm very impressed!  Thanks for responding so quickly! ;D

jeanfabre:
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:
Nice solution! I forget sometimes how flexible the Unity Input Manager is...

Navigation

[0] Message Index

[#] Next page

Go to full version