Author
Topic: Using Playmaker with Rewired (Read 2149 times)

Just started using Rewired. I want to use Xbox and PlayStation controllers in my Windows game, I have set up a Dual Analogue Gamepad map using Rewired Editor.

I have defined all the keyboard and mouse commands in FSM's on my character previously. Can I, and which actions can I use (Rewired integration is done and relevant actions are available), to hook up those commands to that Rewired joystick map? Or is it done otherwise?

After creating your actions inside the Rewired Input Editor, use the "Rewired Get Player Button" action and set it to "every frame" and use and event when the desired button is pressed (or axis used). Inside the next event do what you want and set the "Rewired Get Player Button" action to listen to when you release the button and got to the previous state to listen again for the desired key press.

Rewired requires a script to be written and attached to the character controller and I can't write code, so it doesn't help me (another paid asset into the trash). I am using the SmartFPController asset anyway, it has basic movement built-in for both Xbox gamepad and K&M.

I have used PlayMaker to do the keyboard and mouse commands for firing and loading a gun and using a melee weapon, all which work fine.

So what would be the best approach to set up Xbox 360 gamepad inputs (and maybe later PlayStation 4) and link these into my PlayMaker scripts for the keyboard and mouse commands?

I have looked at the Unity Input Manager but can't figure out how to use it with PlayMaker. Besides it lists 404 inputs (perhaps because of the SmartFPController?) which match what gamepad buttons I have no idea.

rewired will work fine for your playMaker inputs as you are describing them. Why not using it for this? Setting up Unity Input manually for supported various gamePads is litteraly impossible by hand hence why so many publishers provides framework around this lack of built in Input proper support.

Have other things to do now, but I will get back to working with Rewired and PlayMaker in a little while. Probably take a few more posts for me to understand how to use them together. I do appreciate your help.

You CAN use Playmaker and Rewired to do what you are planning even if you use an unknown/non-listed gamepad (I'm using one and Rewired gives basic support for it you just need to configure). I know that it is really confusing to understand how to use Rewired but I am pretty sure that you can find almost all help you need using the help files. Some vital information are spread across the sections of the help file. Take some time to try to make what you want and look for answers in the help file. If you can't figure it out ask here or directly to the developer. I can asure you that you will regret if you this asset away.

Just started using Rewired. I want to use Xbox and PlayStation controllers in my Windows game, I have set up a Dual Analogue Gamepad map using Rewired Editor.

I have defined all the keyboard and mouse commands in FSM's on my character previously. Can I, and which actions can I use (Rewired integration is done and relevant actions are available), to hook up those commands to that Rewired joystick map? Or is it done otherwise?

The very first thing you should do is read the documentation. This documentation applies whether or not your're using PlayMaker. You need to understand the concepts about setting up your input configuration first. Even after that, all the documentation still applies. PlayMaker's Actions are nothing more than wrappers around the equivalent Rewired functions. For example, in code, to get input for "Move Horizontal", you type:

player.GetAxis("MoveHorizontal");

In PlayMaker, you use the RewiredPlayerGetAxis Action and set the value of the Action you want to "MoveHorizontal".

They are functionally equivalent. Nearly the entire Rewired API is the same way.

Rewired will provide you the raw input values you need (button presses, axis values, etc.), but it will not apply these input values to your character / cursor / whatever object you're moving. That would be beyond the scope of the system. Any PlayMaker Actions that exist to move characters, etc. that can read an external variable (Vector2, float, boolean, etc.) will work with Rewired because you just store the resulting action's value as a variable and have your other PM Action read that variable. There are also events on some of the Actions like RewiredPlayerGetButtonDown where you can use the Is True event to then branch to some other PM Action.