private static float GetDeltaTriggers(GamepadModel model) { var lTrigger = ScalingUtils.ByteToFloat(model.LeftTrigger); var rTrigger = ScalingUtils.ByteToFloat(model.RightTrigger); var deltaTriggers = rTrigger - lTrigger; return(ScalingUtils.SymmetricalConstrain(deltaTriggers, 1.0f) * 800.0f); // -800:800 range }
private static float GetDirection(GamepadModel model) { const float deadZone = 0.2f; var leftRightStick = ScalingUtils.ShortToFloat(model.LeftThumbStick.Horizontal); if (leftRightStick <= deadZone && leftRightStick >= -deadZone) { leftRightStick = 0; } leftRightStick *= 0.1f; // -0.1:0.1 range return(ScalingUtils.SymmetricalConstrain(leftRightStick, 0.1f)); }