/// <summary> /// Normalizes raw values to calculate X and Y /// </summary> public void Normalize() { // This is a square deadzone if ((rawX - centerX < deadXp && rawX - centerX > deadXn) && (rawY - centerY < deadYp && rawY - centerY > deadYn)) { X = 0; Y = 0; return; } X = Nintroller.Normalize(rawX, minX, centerX, maxX, deadXp, deadXn); Y = Nintroller.Normalize(rawY, minY, centerY, maxY, deadYp, deadYn); if (antiDeadzone != 0) { if (X != 0) { X = X * (1f - antiDeadzone) + antiDeadzone * Math.Sign(X); } if (Y != 0) { Y = Y * (1f - antiDeadzone) + antiDeadzone * Math.Sign(Y); } } }
/// <summary> /// Calculates the normalized values. /// </summary> public void Normalize() { // Cubic deadzone if (Math.Abs(rawX) < deadX && Math.Abs(rawY) < deadY && Math.Abs(rawZ) < deadZ) { X = 0; Y = 0; Z = 0; return; } X = Nintroller.Normalize(rawX, minX, centerX, maxX, deadX); Y = Nintroller.Normalize(rawY, minY, centerY, maxY, deadY); Z = Nintroller.Normalize(rawZ, minZ, centerZ, maxZ, deadZ); }