Playmaker Forum

PlayMaker Updates & Downloads => Share New Actions => Topic started by: Thore on September 27, 2018, 04:07:26 PM

Title: Get Axis to Button Down
Post by: Thore on September 27, 2018, 04:07:26 PM
I may be bad at finding actions I need. This one must exist already, and if not, now it does. :)

Take the axis you provide, and treat the directions as buttons ("Negative Button" and "Positive Button", and also the alternatives as listed in Input Manager). To do this right now, you would get the axis, store it into a variable, and then feed it into a float compare. This makes it in one go.


Explanation for Beginners
It's recommended to use the Input Manager (Edit > Project Settings > Input) to map the player input from mouse, controller, keyboards etcetera.

Use Case
Suppose you want up for jumping, and down for crouching, hence you want to treat the input axis direction as if they were buttons (e.g. as they were in old gamepads).

Uses the snappier GetAxisRaw function, which means, there is no ramp up (also see my GetAxisRaw  ( That's a bit of taste, or Game Feel. You can change this by simply replacing "GetAxisRaw" with "GetAxis" in the code. It can also store whether the buttons were pressed, but I have out-commented that functionality, as I don't really see a purpose. If you want to add it back in, just open the code and uncomment it (it's easy for beginners, too). I also have a more advanced similar action I need to revise (on request, otherwise when I get to it), that has settings for stick deadzone and threshold. 
Title: Re: Get Axis to Button Down
Post by: djaydino on September 28, 2018, 01:00:47 AM
You can use axis event :)

and if you want the buttons to react immediately like a button, you need to adjust the sensitivity and the gravity.

But maybe it would be useful actually to have this with the GetAxisRaw.

To store if the 'button' is pressed is actually useful,

Lets say you have a fighting game and you need to press up+button 1

You can use then a 'get fsm bool' (every frame) for both buttons and have a 'bool all true' to check if both buttons are pressed at the same time
In real it is a bit more complex than that, but i hope you understand what i mean :)

Btw do you have a github account?

All the custom actions are stored on github, maybe jean can give access or fork to you so you can add your actions to the ecosystem? :)
Title: Re: Get Axis to Button Down
Post by: Thore on September 28, 2018, 10:49:24 AM
Hi djaydino,

Axis Event is indeed what I was looking for! I now see that my action might still have a use with the store function restored. It's in there, and thus easy to add back.

It surprises me, but I now got in the habit of making more actions. It took me forever to take the plunge, but making easy data-holders and scriptable objects helped me over the cliff. Still a total newbie though. Anyone who is in a similar position: find a tiny action that would be neat to have, and try your hand! I found Playmaker is great to focus on a building block and testing it in nice fashion.

I have no Github account, and though I have some basic knowledge about version control and how it works, I have no clue how to manage files and such things. Maybe I get into that soon, but not this week ;)

I have a couple of actions. But am unsure what's useful, if something like this exist and I just didn't find it, or whether I should dump them into the forum, too. I've made a Button+Axis Direction, too, because I needed that for my platformer.

Today, I made one that uses AxisRaw to power velocity, with a neutral setting (when 0, don't set velocity). I found out that the usual combination of grabbing axis and then setting it to velocity results in override of velocity when the axis is not pushed (as expected), but that also interferes with the physics. Normally, you never notice it, but I was wondering why my actor once attached to a hinge was not swinging freely as it should.
Title: Re: Get Axis to Button Down
Post by: djaydino on September 28, 2018, 09:27:47 PM
On the forum you can share any action you made good or bad,
it's always a good learning experience if others can judge your actions :)

Github looks intimidating but is quite simple to use actually.
Especially when you use the Github desktop app (

I am planning to make a video for this as many of my clients also having difficulties getting started with github :)
Title: Re: Get Axis to Button Down
Post by: Thore on September 29, 2018, 08:12:41 AM
Hi djaydino,
Thanks! That's a good point about feedback, though few seem to take a look into them ;)

Here's the same action as above, but with the 'store' functions.
Title: Re: Get Axis to Button Down
Post by: Aaddiction on October 01, 2018, 11:35:39 AM
Thank you for the actions. Please keep sharing them as much as you like, thank you again.  :)