Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: topscore1632 on July 17, 2017, 09:55:40 AM

Title: Input response problems using controller
Post by: topscore1632 on July 17, 2017, 09:55:40 AM
Hi everyone

I'm using Get Axis and Set Velocity to move the player left and right in a top down shooter. When using the keyboard, it works exactly how I want it to.

However when trying to use an Xbox controller and the left analogue stick, the player moves but without the 'buffer' that it has when using the keys (i.e. when using keys, when you release the key, the player movement slows to a stop. When you release the stick, the movement stops immediately).

I've fiddled with Input Manager settings to try and fix this but with no luck. Is there something easy I'm missing here? How can I replicate that nice buffered movement you get with keyboard input with the controller?

Thanks!
Title: Re: Input response problems using controller
Post by: djaydino on July 17, 2017, 01:26:14 PM
Hi,
I think you can simulate this using 3 states,
in each state you need (from top to bottom)

- "Get Axis" (for your controller) Set multiplier to 1

- "Float Compare" to check the movement. Compare 'Axis' to 0 and turn every frame on
   in left state compare (Equal and Greater Than)
   in Center state compare (Less Than and Greater Than)
   in Right state compare (Equal and Less Than)
   if Equal 'go center state' if Greater Than 'go Right state' if Less Than 'go Left State'

- "Get Velocity" to get the 'current velocity' (every frame must be off!)
- "Float Interpolate" set mode to 'Ease In Out' in 'From Float' place the 'current velocity'
   and 'To Float' (left State -5) (Middle State 0) (Right State 5) value
   Time set to 0.3 and store result in a variable (movement)
- "Set Velocity" place your movement to 'x' and Every Frame on.

I did something like this before, instead of float interpolare you can also use a tween (hotween, dotween) but i do not advice to use itween, it is outdated laggy and slow.

I will try to make a video tomorrow (in a crowded place at the moment)
Title: Re: Input response problems using controller
Post by: topscore1632 on July 18, 2017, 04:41:24 AM
Thanks for the reply - I tried it and it works! I was really hoping there was a simpler solution than that (I thought it would just be some values I needed to change in the Input Manager) but this has helped me out massively.  Thanks very much!
Title: Re: Input response problems using controller
Post by: djaydino on July 18, 2017, 10:22:16 AM
Hi,
Yea it is is pretty bad setup from unity.

Also if you want to use both keyboard and controller there are speed issues.
In this setup you can use both with the same effect. :)