Quick answer: Apple’s GameController API reports raw axes — apply your own radial deadzone. Avoid bundling SDL2 if the engine uses GameController; choose one path per platform.
An Xbox Wireless Controller connected to a Mac reports stick values with 0.05 magnitude when at rest. Your character drifts slowly without input. The same controller on Windows reports 0.00 at rest. macOS’s GameController framework doesn’t auto-filter.
The Per-Platform Difference
Windows XInput applies an automatic deadzone (~7849 of 32768 for thumbsticks). macOS GameController reports raw normalized [-1, 1] values without filtering. Your game receives different numerical patterns from identical hardware depending on OS.
Best practice is to apply radial deadzone yourself, ignoring the platform’s defaults. This makes per-platform behavior consistent.
Radial Deadzone
Vector2 ApplyDeadzone(Vector2 raw, float deadzone = 0.15f) {
float mag = raw.magnitude;
if (mag < deadzone) return Vector2.zero;
float scaled = (mag - deadzone) / (1.0f - deadzone);
return raw.normalized * scaled;
}
Apply on every stick read. With 0.15 deadzone, the resting 0.05 noise becomes 0. Real input above 0.15 passes through, scaled so the dead zone’s edge is treated as 0% rather than 15% to give full analog range.
SDL2 vs GameController Conflict
If your engine bundles SDL2 and macOS also provides GameController framework, both may try to read the same device. Symptoms include double-counted button presses or doubled axis values. Configure the engine to use one path:
- Unity: Input System package uses GameController natively on macOS.
- Unreal: Apple Game Controller plugin uses GameController; ensure it’s active.
- Custom SDL2 build: pass
--disable-joystick-mfito avoid GameController interference, or vice versa.
Expose a Deadzone Slider
Default 0.15 is good. Players with worn sticks need more; gentle players want less. Make it user-tunable. Save to player prefs.
Verifying
Hold the controller idle. Sample sticks over 1 second; max magnitude should be 0 after deadzone applied. Push stick gently — values should respond immediately past the deadzone threshold.
“macOS reports raw; you apply deadzone. Same logic everywhere — consistent feel across platforms.”
Build a controller test screen in your game that prints raw values — helps players self-diagnose stick drift before reporting it as a game bug.