Is there a simple way to avoid going into 0 when taking input from the opposite end of the input axis? for example when using a controller with a joystick and going right, then suddenly turning left. In this case I dont want the input from the axis to first drop to all the way to 0 (which would make the character to into neutral position for a moment) but rather control myself what the min value should be, for instance 0.5. However if the joystick is in neutral position the input should go to 0 as usual.
I don’t know if this helps:
if (axis >= 0.5f) {
// Facing/moving right.
}
else if (axis <= -0.5f) {
// Facing/moving left.
}
else {
// Inside the 'dead' zone.
}
Input Manager → Snap
@numberkruncher Im more thinking of a way to jump straight to an opposite value and never reach 0 along the way, or detecting if I am turning the joystick in the opposite direction while the value drops down to 0 (in this case I can ignore the 0). Then if I release the joystick I will know that it is not pressed in the opposite direction and I can go straight to 0.
@_Daniel Snapping doesnt seem to do anything when I use it with a Xbox controller