Android: Ignore joystick axis movements in the flat area.
Now that all inputs are corrected to zero-centered, we can use getFlat() to ignore movements that are just noise. This eliminates a lot of drift when the controller is at rest, notably on the character select screen in Melee.
This commit is contained in:
parent
6787fcb712
commit
1f81e13d81
|
@ -735,7 +735,16 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
int axis = range.getAxis();
|
||||
float origValue = event.getAxisValue(axis);
|
||||
float value = mControllerMappingHelper.scaleAxis(input, axis, origValue);
|
||||
NativeLibrary.onGamePadMoveEvent(input.getDescriptor(), axis, value);
|
||||
// If the input is still in the "flat" area, that means it's really zero.
|
||||
// This is used to compensate for imprecision in joysticks.
|
||||
if (Math.abs(value) > range.getFlat())
|
||||
{
|
||||
NativeLibrary.onGamePadMoveEvent(input.getDescriptor(), axis, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
NativeLibrary.onGamePadMoveEvent(input.getDescriptor(), axis, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue