How to control aixs gravity, sensitivity in new Input System
Hi I'm trying to use new input system.
I found that in the new system the axis input does not support gravity or sensitivity at basic setting.
but i want to control gravity or sensitivity like old version.
How can i solve this problem.
thank you
Answer by CheekiBreekiBradenski · May 01, 2020 at 09:38 AM
Hi @TrollInSecret , I believe this is done through the GUI in your InputActionSystem. Navigate to the relevant binding and add a processor (scaling, inversion deadzone etc). So to change the sensitivity you will change the scaling of the Vectors or whatever option it provides you with, and it seems to work as a fractional value. I hope this helps you or at least gets you close to the right answer.
I have the same question as @TrollInSecret above and just tried your suggestion. The scale option didn't have the desired effect of dropping the input smoothly from 1 to 0 over a fraction of a second (for gravity or vice versa for sensitivity) but merely multiplied the input by the scale (e.g. with a scale of 10, my character moved 10 times as fast and a scale of .1 moved a tenth as fast). The Processor menu does seem to be the logical place to find sensitivity and gravity, but the Scale processor was not the equivalent. Please correct me if I am wrong and simply didn't follow your instructions correctly.
Answer by Nickp2905 · Jun 29, 2020 at 12:00 PM
Hi, I was looking at the same problem.
Under the 'Processors' for a 'Left Stick [Gamepad] I added, a 'Scale Vector 2' processor. Then set X to the value of 20 and Y to the same value. Saved the asset and retried my gamepad controller, and the look rotation was vastly improved. This had no effect on my mouse controller. Regards, Nick
Answer by frostfromwayback · Feb 20, 2021 at 07:11 AM
https://answers.unity.com/questions/1699430/how-can-i-apply-sensitivity-in-new-input-system-fo.html
This solution uses Mathf.MoveTowards(...) to achieve this. The scaling needs to be done on the input relative to time, so scaling in the editor doesn't seem to work. Would be interested if there's an alternate way that Unity considers best practice...
This seems like such a silly work around, I'm really surprised they don't have a gravity option under processors. To address the "scaling relative to time" problem you mentioned, you could use Time.fixedDeltaTime rather than just deltaTime so it's universal across systems; however, it still seems like a band-aid solution... Either way, thanks for the tip! This got my desired result.
Answer by Wollbobaggins · Mar 09, 2021 at 08:13 PM
this was the solution I used, adding input gravity, inspired by @frostfromwayback. PrepareControlsInput() is called within the update/fixed update Unity method
[SerializeField, Range(0f, 100f)] float inputGravity = 10f;
Controls controls;
private Vector2 controlsInput;
private Vector2 deltaInput;
// other code...
private void GetControlsInput(InputAction.CallbackContext ctx)
{
controlsInput = ctx.ReadValue<Vector2>();
}
private void PrepareControlsInput()
{
// input gravity
deltaInput.x = Mathf.MoveTowards(
deltaInput.x, controlsInput.x, Time.fixedDeltaTime * inputGravity
);
deltaInput.y = Mathf.MoveTowards(
deltaInput.y, controlsInput.y, Time.fixedDeltaTime * inputGravity
);
// input clamped normalization
deltaInput = Vector2.ClampMagnitude(deltaInput, 1f);
}
Your answer
Follow this Question
Related Questions
PointAndClick 1 Answer
How use ANDROID NAVIGATION BUTTONS 0 Answers
Touch Controls without virtual joystick 0 Answers
how can i touch the fast objects ? 1 Answer
i need help making a dash ability for my endless runner game 2 Answers