What the title says. The Axis value increases and decreases gradually, but I want it at some point to become 0.
Is it possible?
What the title says. The Axis value increases and decreases gradually, but I want it at some point to become 0.
Is it possible?
Unity - Scripting API: Input.GetAxisRaw does not work?
Hmm… make a condition for it? A bool for example.
Lets just look at the horizontal one but you can apply it to vertical too.
C#
public bool canWork = true;
if(Input.GetAxis("Horizontal") > 0 && canWork)
{
//do whatever you wanna do
}
else if(Input.GetAxis("Horizontal") > 0 && !canWork)
{
//if you make that canWork boolean false, this will happen, the axis wont register, and it'll be null/zero
}
Js
var canWork : boolean = true;
if(Input.GetAxis("Horizontal") > 0 && canWork)
{
//do whatever you wanna do
}
else if(Input.GetAxis("Horizontal") > 0 && !canWork)
{
//if you make that canWork boolean false, this will happen, the axis wont register, and it'll be null/zero
}
Its untested but something like that should work.