playMaker

Author Topic: Help with analogue input easing on a Character controller  (Read 832 times)

slartibart

  • Playmaker Newbie
  • *
  • Posts: 2
    • View Profile
Help with analogue input easing on a Character controller
« on: July 06, 2018, 06:15:20 AM »
Hello!

I'm using Rewired to get axis input from a gamepad analogue stick. This gives me two floating values which I use to generate a vector, which is the target of my Controller Move. This works great except my character starts and stops instantly, and I'm trying to achieve a gradual acceleration/deceleration.

I think I would need to implement some sort of easing/damping on my input axis, but I can't really wrap my head around on how to go about doing this as I'm trying to ease to a constantly moving target.

Any ideas or pointers in the right direction would be greatly appreciated.

LordHorusNL

  • Beta Group
  • Full Member
  • *
  • Posts: 165
    • View Profile
Re: Help with analogue input easing on a Character controller
« Reply #1 on: July 06, 2018, 06:59:22 AM »
"Ease Float" is probably what you want to use, just have it interpolate from 0 to your move speed over time. Just play around with it and it should do the trick.

Something like.

time: 0,5
speed: 2,5
ease type : linear

And set it to not finish because you'll only want it to run once when you enter the state i would assume.
« Last Edit: July 06, 2018, 07:01:59 AM by LordHorusNL »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4615
    • View Profile
    • jinxtergames
Re: Help with analogue input easing on a Character controller
« Reply #2 on: July 06, 2018, 09:52:14 AM »
Hi.
In unity inside the input manager you can use 'Gravity' and 'Sensitivity' to adjust the "Reaction"

In rewired there must also be something like this, but not sure where to find at the moment.

slartibart

  • Playmaker Newbie
  • *
  • Posts: 2
    • View Profile
Re: Help with analogue input easing on a Character controller
« Reply #3 on: July 06, 2018, 12:51:05 PM »
Thanks, for replies. I don't see how a simple ease would work since my target would be a constantly changing float between -1 and +1.


Hi.
In unity inside the input manager you can use 'Gravity' and 'Sensitivity' to adjust the "Reaction"

In rewired there must also be something like this, but not sure where to find at the moment.

Yes, I think a gravity modifier would be the easiest way to solve this. I googled around quite a bit before posting my question, but as far as I can figure out Rewired has no such setting, only sensitivity which wouldn't really make any difference in this case, just up the values I'm working with. They do have a gravity setting for simulating a joystick when using binary buttons though, so I guess I could use that but then I would loose input granularity.

So I guess my options are to either figure out how to do this manually or just ditch Rewired and use the stock Unity input manager.

LordHorusNL

  • Beta Group
  • Full Member
  • *
  • Posts: 165
    • View Profile
Re: Help with analogue input easing on a Character controller
« Reply #4 on: July 06, 2018, 01:50:11 PM »
Yeah disregard my answer, misunderstood your question ;D

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4615
    • View Profile
    • jinxtergames
Re: Help with analogue input easing on a Character controller
« Reply #5 on: July 07, 2018, 04:00:57 AM »
Hi.
Hmm... maybe one of the 'smooth dam'p actions could work?

You can find them on the Ecosystem

I will have a look @ rewired after the weekend.

DanielThomas

  • Beta Group
  • Full Member
  • *
  • Posts: 129
    • View Profile
Re: Help with analogue input easing on a Character controller
« Reply #6 on: July 07, 2018, 05:43:13 AM »
I'm doing this and I use velocity to move my character.
1. So I have the verticalX and verticalY (2D game, shouldn't matter though) variables that the input is feeding, but them in axisVector.
2. Then I have a float damp moveVector to damp towards axisVector.
3. Use moveVector to set the velocity.

Would that work for you?
I also noticed some gamepads (cheaper ones I guess) just goes from 0 to 1, while some  has a range from 0 to 1 depending how far you are moving the stick. Maybe just something to keep in mind to avoid some unwanted movement.