TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/facepunch/sbox-public/llms.txt
Use this file to discover all available pages before exploring further.
Input static class is the primary way to read player input in s&box. It provides action-based queries (Down, Pressed, Released), analog values for movement and camera look, raw mouse and wheel deltas, direct keyboard key queries via Input.Keyboard, and VR controller data via Input.VR.
All input queries return
false or default when Input.Suppressed is
true (e.g. when a UI panel has focus) or when running headless.Action queries
Actions are named bindings defined in the game’s Input Settings asset. The default action set covers common gameplay verbs. Use the action name string to query state.Returns
true while the action is held. Call this every tick to check a continuous hold.Returns
true on the first tick the action transitions from released to held — i.e. the press edge. Use this for one-shot events like firing a weapon.Returns
true on the first tick the action transitions from held to released — the release edge.Programmatically activates or deactivates an action. Useful for AI or replay systems that synthesize input.
Clears a single action so it is no longer considered pressed. Equivalent to
SetAction( action, false ).Clears all current and previous action states so no actions are active this tick.
Releases all actions and resets accumulated press state. Unlike
ClearActions, the actions will not re-activate until the player physically presses them again.Releases a single action and resets its accumulated press state.
Default actions
Games that do not define a custom input settings asset receive the following defaults:| Group | Action | Default Key | Gamepad |
|---|---|---|---|
| Movement | Forward | W | — |
| Movement | Backward | S | — |
| Movement | Left | A | — |
| Movement | Right | D | — |
| Movement | Jump | Space | A Button |
| Movement | Run | Shift | Left Stick Click |
| Movement | Walk | Alt | — |
| Movement | Duck | Ctrl | B Button |
| Actions | Attack1 | Mouse1 | Right Trigger |
| Actions | Attack2 | Mouse2 | Left Trigger |
| Actions | Reload | R | X Button |
| Actions | Use | E | Y Button |
| Inventory | Slot1–Slot0 | 1–0 | D-pad |
| Inventory | SlotPrev / SlotNext | Mouse4 / Mouse5 | Bumpers |
| Misc | View | C | Right Stick Click |
| Misc | Voice | V | — |
| Misc | Drop | G | — |
| Misc | Flashlight | F | D-pad Up |
| Misc | Score | Tab | Left Menu |
| Misc | Menu | Q | Right Menu |
| Misc | Chat | Enter | — |
Analog values
The look delta for this tick, already scaled by
Preferences.Sensitivity. Pitch and yaw are non-zero only when the mouse cursor is hidden. Respect Preferences.InvertMousePitch and Preferences.InvertMouseYaw — these are applied automatically.Write to this property inside a BuildInput override to override the look value before it is consumed by the camera.A unit movement vector derived from the
Forward, Backward, Left, and Right actions plus any analog gamepad joystick input. Components are in the range [-1, 1].Write to this property to override movement direction.Raw mouse movement in pixels since the last frame. Not sensitivity-scaled. Use
AnalogLook for a sensitivity-corrected look delta.Scroll wheel delta.
Y is the primary scroll axis; X is horizontal scroll.true when the OS cursor is visible, typically because a UI panel has focus. When true, AnalogLook is zeroed automatically.Motion sensor data (gyroscope/accelerometer) from supported controllers: DualShock 4+, Nintendo Switch controllers, Steam Controller, and Steam Deck. Check whether the current controller supports motion before relying on this value.
Controller state
Returns
true when the most recent button press came from a gamepad rather than a keyboard or mouse. Use this to switch HUD prompts between keyboard and controller glyphs.true when Escape was pressed this frame. You can set this to false to consume the event and prevent the default menu toggle.Access to VR-specific controller input. Returns
VRInput.Current.Action discovery
All action names registered by the current game’s input settings.
Returns a copy of all registered
InputAction definitions including their name, keyboard code, and gamepad code.Returns the group name (e.g.
"Movement", "Actions") for the given action name.Returns the user-facing label for the button bound to the given action. Returns the gamepad button name when a controller is active, otherwise the local keyboard key name (e.g.
"SPACE" or "A Button").Input.Keyboard
Input.Keyboard lets you query raw physical key state independently of the action system. Use it when you need to detect a specific key that is not mapped to a game action.
Returns
true while the physical key is held. keyName is a string like "space", "a", "ctrl", or "mouse1".Returns
true on the first tick the key transitions from released to held.Returns
true on the first tick the key transitions from held to released.Usage examples
Related pages
Input guide
How to set up input actions, custom bindings, and action graphs.
Game class
Global game state including
IsEditor and session management.