Search Unity

Gamepad Stick Sensitivity

Discussion in 'Input System' started by jeffweber, Sep 29, 2019.

  1. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    Is there currently a way built-in way to set Gamepad Stick Sensitivity?

    I would like be able to set a factor that controls how fast the stick position values move to the actual physical stick position.

    -Jeff
     
  2. Jichaels

    Jichaels

    Joined:
    Dec 27, 2018
    Posts:
    237
    Yeah, just multiply your input vector by a factor ? What do you want to achieve exactly ?
     
  3. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    I was hoping that there would be a "Sensitivity" option under the "Processors" that would take a factor to Lerp to the actual input value. Something equivalent to var position = Vector2.Lerp(ActualPosition, TargetPostion, .1).

    This is what I'm doing to achieve what I want, but it would be nice to just have an option in the Processors list for it.
     
  4. Jichaels

    Jichaels

    Joined:
    Dec 27, 2018
    Posts:
    237
    Not sure what you mean by that, but lerping with a constant value is pointless. If you want to scale your input vector by 0.1, there is a scale processor. But then again, having that in your code is much more efficient as you can expose it to users using a UI slider or whatever to adjust the sensitivity at runtime.
     
  5. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    I currently perform that "Lerp" within my own update method so the "ActualPosition" is always "Chasing" the TargetPosition. I think this is similar to how Sensitivity worked with the old input system.
    I think it would make sense to have this sensitivity setting available within the action editor... but then maybe that's not possible with the way the new input system works.
     
  6. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,510
    I also miss the sensitivity and gravity settings in the new InputSystem.

    Indeed, the old Input system doesn't apply a Lerp operation, but a MoveTowards at a given rate:
    • sensitivity when TargetPosition is farther from the origin than ActualPosition
    • gravity when TargetPosition is closer to the origin than ActualPosition
    • sensitivity+gravity when TargetPosition and ActualPosition are at opposite sides of the origin
    I've replicated this system to apply sensitivity and gravity in touch controls. It would be good if we could have this functionality available in the new input system somehow, instead of having to replicate it in our code.
     
  7. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    It's on the list to get looked at after 1.0 as part of allowing processors to be stateful. ATM the processing logic at the device level is required to be stateless -- which is a problem for stuff like wanting to gradually lerp. Hopefully, that restriction will go away after 1.0.
     
  8. Bencarbon

    Bencarbon

    Joined:
    Jul 17, 2018
    Posts:
    3
    @Edy Could you please share the code you used to replicate the old behavior?
     
  9. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,510
    @Bencarbon Sure, the actual utility class I use to handle the input is attached. The arguments moveRate and pressRate are equivalent to Sensitivity, and centerRate / releaseRate are equivalent to Gravity.
     

    Attached Files: