Use Tune to ignore small stick movements. The example uses a virtual pad, a simulated controller, so you don’t need a physical gamepad.
dotnet add package RecursiveAI.OneGame.HostRequires .NET 10 (net10.0); .NET 9 and earlier aren’t supported.
using OneGame.Platform; var actions = new ActionMap(); actions.Context("play", c => c .Vector("move", Bind.LeftStick) .Tune("move", deadZone: 0.25f)); using var app = PlatformApp.Create(new() { Backend = PlatformBackendKind.Headless, EnableGamepadDevices = false }); var pad = app.Injector.GamepadConnect(); app.Injector.GamepadAxis( pad, GamepadAxis.LeftX, 0.625f); app.PumpEvents(); while (app.TryGetEvent(out var evt)) actions.Observe(evt); actions.Update(app.Input, 1, 1); var move = actions.Vector("move"); Console.WriteLine(FormattableString.Invariant( $"({move.X:0.00}, {move.Y:0.00})"));
With a 0.25 dead zone, a horizontal input of 0.625 reads as half strength:
(0.50, 0.00)Unzip the example, then dotnet run.
The full program
The download sends three horizontal values through the virtual pad; its Y axis stays at zero. No window or input file is needed. PumpEvents processes the injected input, then Update computes the action values for the frame. The 1, 1 arguments stand in for the window dimensions, which the stick binding doesn’t use.
For a real game, declare the action in DefineActions and read game.Actions.Vector("move") in OnEachFrame. The input guide shows both methods.
using OneGame.Platform; using System.Globalization; CultureInfo.CurrentCulture = CultureInfo.InvariantCulture; using var app = PlatformApp.Create(new() { Backend = PlatformBackendKind.Headless, EnableGamepadDevices = false }); var pad = app.Injector.GamepadConnect(); var actions = new ActionMap(); actions.Context("play", c => c .Vector("move", Bind.LeftStick) .Tune("move", deadZone: 0.25f)); foreach (var x in new[] { 0.10f, 0.625f, 1f }) { app.Injector.GamepadAxis( pad, GamepadAxis.LeftX, x); app.PumpEvents(); while (app.TryGetEvent(out var evt)) actions.Observe(evt); actions.Update(app.Input, 1, 1); var move = actions.Vector("move"); Console.WriteLine( $"{x:0.000} -> ({move.X:0.00}, {move.Y:0.00})"); }
dotnet run prints the injected X value on the left and the filtered (X, Y) on the right:
0.100 -> (0.00, 0.00) 0.625 -> (0.50, 0.00) 1.000 -> (1.00, 0.00)
If Vector throws because the action isn’t declared, check that its name matches the one in the Vector declaration. An inactive context reads zero instead.
Variations
Use the right stick. In the full program, replace Bind.LeftStick in the declaration and GamepadAxis.LeftX in the fixture with their right-stick equivalents:
actions.Context("play", c => c .Vector("move", Bind.RightStick) .Tune("move", deadZone: 0.25f));
app.Injector.GamepadAxis( pad, GamepadAxis.RightX, x);
Related recipes
Input actions · Navigate a game menu with a controller
The short answer
Bind a vector action to Bind.LeftStick, set its deadZone with Tune, and read its filtered X and Y with actions.Vector("move"). In a running game, the host updates the action map each frame. Positive X is right and positive Y is down.
What is a dead zone on a controller stick?
A stick can report a small offset even while you’re not touching it. A dead zone treats those values as neutral so a character or camera doesn’t drift. onegame uses a radial dead zone for stick actions: it checks the length of the whole vector, not each axis separately. That means a diagonal push can be outside the circle even when neither axis alone exceeds the dead-zone setting. See Doing Thumbstick Dead Zones Right for the difference between radial and per-axis filtering.
What should my gamepad dead zone be?
Start with the action’s default of 0.15 and test the controller at rest and during slow movement. Raise the setting if the action still drifts at rest; lower it if deliberate small pushes are lost. The 0.25 in the example is for making the before-and-after values easy to see, not a recommendation for every controller.
At or inside the radius, the action returns (0, 0). Outside it, onegame keeps the stick direction and rescales the length so it starts from zero at the boundary and reaches one at full travel. On the X axis, the example’s 0.625 is halfway between 0.25 and 1.0, so it reads as 0.50. The threshold setting in Tune is separate: it controls when Held becomes true, not which positions read as zero.
Why does my controller dead zone feel different in the game?
The virtual pad injects axis values as given, so this example isolates the action’s dead zone. For physical input, the platform can apply its own PlatformOptions.StickDeadZone before the action sees the stick. The action setting applies to the value it receives, not necessarily to the raw hardware position. Try both slow movement and full travel on the hardware your players will use; the injected fixture checks the action mapping, not the controller or driver.