[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6KRB143VFWEF50DGTK4AF74":3,"skill-same:01M6KRB143VFWEF50DGTK4AF74":84},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":30,"linkOnly":31,"markdownContent":32,"markdownBody":33,"frontMatter":34,"refName":35,"commitSha":36,"skillDirectory":37,"forksCount":38,"repositoryHtmlUrl":39,"repositoryHomepageUrl":6,"ownerHtmlUrl":40,"ownerBlogUrl":41,"ownerDescription":42,"updatedAt":43,"install":44,"resources":57},"01M6KRB143VFWEF50DGTK4AF74","input-handling",null,"Use when implementing input — InputEvent system, Input Map actions, controllers\u002Fgamepads, mouse\u002Ftouch, action rebinding, and input architecture","jame581\u002FGodotPrompter","jame581","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F21112138?v=4","01M6KR3KEQ9Z30WVJRR2E2ZVXE","Jan Mesarč","01M6KR3KJVRMPDSMASQPBCBVK3",964,"MIT","https:\u002F\u002Fgithub.com\u002Fjame581\u002FGodotPrompter\u002Fblob\u002Fmaster\u002Fskills\u002Finput-handling\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29],"input handling","input","system","actions","implementing","touch","map","use","architecture","action","when","2026-11-10 10:12:30",false,"---\nname: input-handling\ndescription: Use when implementing input — InputEvent system, Input Map actions, controllers\u002Fgamepads, mouse\u002Ftouch, action rebinding, and input architecture\n---\n\n# Input Handling in Godot 4.3+\n\nAll examples target Godot 4.3+ with no deprecated APIs. GDScript is shown first, then C#.\n\n> **Related skills:** **player-controller** for movement driven by input, **godot-ui** for UI input focus and navigation, **save-load** for persisting custom key bindings, **responsive-ui** for touch vs desktop input adaptation, **xr-development** for XR controller and hand tracking input, **mobile-development** for mobile sensors and app lifecycle.\n\n---\n\n## 1. Core Concepts\n\n### Input Flow\n\n```\nHardware Event (key, mouse, gamepad)\n    ↓\nEngine converts to InputEvent\n    ↓\n_input()              ← raw input, runs first\n    ↓\nUI Control nodes      ← _gui_input: buttons, sliders consume events\n    ↓\n_shortcut_input()     ← for global shortcuts\n    ↓\n_unhandled_key_input() ← unhandled key-only events\n    ↓\n_unhandled_input()    ← game input (movement, actions)\n```\n\n### Where to Handle Input\n\n| Method | Use For | When It Runs |\n|---------------------------|--------------------------------------------|------------------|\n| `_input()` | Camera look, global hotkeys | First — before everything |\n| `_shortcut_input()` | Global shortcuts (pause, screenshot) | After UI, before unhandled |\n| `_unhandled_key_input()` | Key-only events that UI didn't consume | After UI, keys only |\n| `_unhandled_input()` | Gameplay actions (jump, attack, interact) | Last — after UI consumes |\n| `Input.is_action_pressed()` in `_physics_process()` | Continuous movement | N\u002FA — polling, not event-driven |\n\n**Rule of thumb:** Use `_unhandled_input()` for discrete game actions (jump, attack). Use `Input` polling in `_physics_process()` for continuous movement. Use `_input()` only when you need input before UI consumes it (e.g., mouse look).\n\n### InputEvent Hierarchy\n\n```\nInputEvent\n├── InputEventFromWindow\n│   ├── InputEventWithModifiers\n│   │   ├── InputEventKey            ← keyboard\n│   │   ├── InputEventMouse\n│   │   │   ├── InputEventMouseButton ← mouse clicks\n│   │   │   └── InputEventMouseMotion ← mouse movement\n│   │   └── InputEventGesture        ← Magnify \u002F Pan gestures\n│   ├── InputEventScreenTouch        ← touchscreen tap\n│   └── InputEventScreenDrag         ← touchscreen drag\n├── InputEventJoypadButton     ← gamepad buttons\n├── InputEventJoypadMotion     ← gamepad sticks\u002Ftriggers\n├── InputEventAction           ← synthetic action events\n├── InputEventMIDI             ← MIDI devices\n└── InputEventShortcut\n```\n\n---\n\n## 2. Input Map Setup\n\nDefine actions in **Project > Project Settings > Input Map** instead of checking raw keycodes. This decouples game logic from specific keys and enables rebinding.\n\n### Default Project Actions\n\nGodot ships with `ui_*` actions: `ui_accept`, `ui_cancel`, `ui_left`, `ui_right`, `ui_up`, `ui_down`, etc. These are used by UI controls for keyboard navigation. You can use them for gameplay but creating custom actions is preferred to avoid conflicts.\n\n### Adding Actions in Code\n\nActions can be created at runtime with `InputMap.add_action()` + `InputMap.action_add_event()` — typically in an autoload `_ready()`, guarded by `InputMap.has_action()`. Define actions in the editor Input Map; only add them in code for dynamically generated bindings or mod support.\n\n> See [references\u002Faction-rebinding.md](references\u002Faction-rebinding.md) for the GDScript and C# snippet.\n\n### Recommended Action Names\n\nUse descriptive, game-specific names instead of key names:\n\n| Good | Bad | Why |\n|---------------------|------------------|--------------------------------------|\n| `move_left` | `press_a` | Decoupled from physical key |\n| `attack` | `left_click` | Works for mouse and gamepad |\n| `interact` | `press_e` | Rebindable without changing logic |\n| `sprint` | `hold_shift` | Input-agnostic |\n| `pause` | `press_escape` | Can map to gamepad Start button too |\n\n---\n\n## 3. Reading Input — Events vs Polling\n\n### Event-Driven (Discrete Actions)\n\nUse `_unhandled_input()` for one-shot actions: jump, attack, interact, pause.\n\n#### GDScript\n\n```gdscript\nfunc _unhandled_input(event: InputEvent) -> void:\n    if event.is_action_pressed(\"jump\"):\n        _jump()\n        get_viewport().set_input_as_handled()  # prevent further propagation\n\n    if event.is_action_pressed(\"interact\"):\n        _interact()\n\n    if event.is_action_pressed(\"pause\"):\n        get_tree().paused = not get_tree().paused\n        get_viewport().set_input_as_handled()\n```\n\n#### C#\n\n```csharp\npublic override void _UnhandledInput(InputEvent @event)\n{\n    if (@event.IsActionPressed(\"jump\"))\n    {\n        Jump();\n        GetViewport().SetInputAsHandled();\n    }\n\n    if (@event.IsActionPressed(\"interact\"))\n        Interact();\n\n    if (@event.IsActionPressed(\"pause\"))\n    {\n        GetTree().Paused = !GetTree().Paused;\n        GetViewport().SetInputAsHandled();\n    }\n}\n```\n\n### Polling (Continuous Input)\n\nUse `Input` singleton in `_physics_process()` for held buttons and analog axes.\n\n#### GDScript\n\n```gdscript\nfunc _physics_process(delta: float) -> void:\n    # Movement vector from 4 directional actions\n    var direction := Input.get_vector(\"move_left\", \"move_right\", \"move_up\", \"move_down\")\n    velocity = direction * speed\n\n    # Check if a button is held\n    if Input.is_action_pressed(\"sprint\"):\n        velocity *= 1.5\n\n    move_and_slide()\n```\n\n#### C#\n\n```csharp\npublic override void _PhysicsProcess(double delta)\n{\n    Vector2 direction = Input.GetVector(\"move_left\", \"move_right\", \"move_up\", \"move_down\");\n    Velocity = direction * Speed;\n\n    if (Input.IsActionPressed(\"sprint\"))\n        Velocity *= 1.5f;\n\n    MoveAndSlide();\n}\n```\n\n### Key Input Methods\n\n| Method | Returns | Use For |\n|-----------------------------------|---------|--------------------------------------|\n| `Input.is_action_pressed()` | `bool` | Held buttons (sprint, crouch, fire) |\n| `Input.is_action_just_pressed()` | `bool` | One-shot triggers (jump, interact) |\n| `Input.is_action_just_released()` | `bool` | Release triggers (variable jump cut) |\n| `Input.get_action_strength()` | `float` | Analog pressure (0.0–1.0) |\n| `Input.get_axis()` | `float` | Single axis (-1.0 to 1.0) |\n| `Input.get_vector()` | `Vector2` | 2D direction, length capped at 1 |\n| `event.is_action_pressed()` | `bool` | Check in `_unhandled_input` callback |\n| `event.is_action_released()` | `bool` | Check in `_unhandled_input` callback |\n\n> **`Input.is_action_just_pressed()` in `_physics_process()` reports a press on the next physics tick**, even if the key was already released — a low tick rate does not drop taps, but several presses inside one tick count once. When each press matters, catch it in `_unhandled_input()` and set a flag.\n\n### Input Buffering\n\nBuffer discrete actions so a press made shortly before it can take effect (jump just before landing) still counts: catch the action in `_unhandled_input()`, set a flag with a short timer (0.1 s is typical), and consume the flag in `_physics_process()`.\n\n> See [references\u002Finput-buffering.md](references\u002Finput-buffering.md) for the full GDScript and C# jump-buffer implementation.\n\n---\n\n## 4. Mouse Input\n\n`InputEventMouseMotion.relative` for camera look (with `Input.MOUSE_MODE_CAPTURED`), `InputEventMouseButton` for clicks. Mouse modes: `VISIBLE`, `HIDDEN`, `CAPTURED`, `CONFINED`. Custom cursor via `Input.set_custom_mouse_cursor(texture, shape, hotspot)`.\n\n> See [references\u002Fmouse.md](references\u002Fmouse.md) for the full GDScript and C# recipes (camera-look with sensitivity + invert toggle, mouse-mode switching, button events, custom cursor with shape variants).\n\n---\n\n## 5. Controller \u002F Gamepad Support\n\n`Input.get_connected_joypads()` for runtime detection, `Input.joy_connection_changed` signal for hot-plug. Use Input Map actions with joypad button events for portability. Analog sticks: `Input.get_vector(\"left\", \"right\", \"up\", \"down\", deadzone)` returns a length-clamped Vector2 with built-in deadzone.\n\n> See [references\u002Fgamepad.md](references\u002Fgamepad.md) for the GDScript and C# recipes (controller detection, deadzone analog reading, vibration via `start_joy_vibration`, motion sensors, detecting last-input-device for UI prompt swapping).\n\n> **Changed in Godot 4.8:** Projects **newly created** in 4.8 set `input_devices\u002Fjoypads\u002Fignore_joypad_on_unfocused_application = true`: joypad input (including motion sensors) and LED changes are ignored, and vibration is stopped, while the window is unfocused. The class default stays `false`, so older and upgraded projects are unchanged. If a gamepad seems dead while testing with another window focused, or in a second-window local-multiplayer setup, check this setting.\n\n> **Godot 4.7+:** Joypad motion sensors — `Input.get_joy_accelerometer(device)` \u002F `get_joy_gyroscope(device)` (both `Vector3`), guarded by `has_joy_motion_sensors()` and enabled with `set_joy_motion_sensors_enabled()`; recipe in [references\u002Fgamepad.md](references\u002Fgamepad.md). Vibration is now queryable — `Input.has_joy_vibration(device)` plus `get_joy_vibration_strength\u002Fduration\u002Fremaining_duration()`. `JoyButton` gains `JOY_BUTTON_MISC2` (`21`) through `JOY_BUTTON_MISC6` (`25`) (C#: `JoyButton.Misc2`…). New project setting `input_devices\u002Fjoypads\u002Fignore_joypad_on_unfocused_application` (default `false`) ignores joypad input (including motion sensors) and LED changes and stops vibration while the app is unfocused.\n\n---\n\n## 6. Touch Input\n\n`InputEventScreenTouch` for tap\u002Frelease, `InputEventScreenDrag` for finger drag; multi-touch is tracked by `event.index`. To test on desktop, enable **Project Settings → Input Devices → Pointing → Emulate Touch From Mouse**; **Emulate Mouse From Touch** is on by default so UI works on touchscreens.\n\n> See [references\u002Ftouch.md](references\u002Ftouch.md) for the touch event recipes (GDScript and C#) and the `VirtualJoystick` on-screen stick (Godot 4.7+).\n\n---\n\n## 7. Action Rebinding at Runtime\n\nThree steps: (1) capture the user's chosen key via `_input` while in \"rebinding\" mode, (2) call `InputMap.action_erase_events(action)` then `InputMap.action_add_event(action, new_event)`, (3) persist via `ConfigFile` and reload on launch.\n\n> See [references\u002Faction-rebinding.md](references\u002Faction-rebinding.md) for the full GDScript and C# rebinding flow including ConfigFile save\u002Fload and the typical \"press a key\" capture UI.\n\n---\n\n## 8. Consuming and Propagating Input\n\nInput propagates in **reverse scene tree order** (the node lowest in the Scene dock first, root last); call `get_viewport().set_input_as_handled()` after consuming an event to stop it reaching other nodes. During pause, only nodes with `process_mode` `PROCESS_MODE_ALWAYS` or `PROCESS_MODE_WHEN_PAUSED` receive input.\n\n> See [references\u002Fevent-propagation.md](references\u002Fevent-propagation.md) for the GDScript and C# recipes (stopping propagation, node processing order, receiving input while paused).\n\n---\n\n## 9. Common Pitfalls\n\n| Symptom | Cause | Fix |\n|--------------------------------------|--------------------------------------------------|--------------------------------------------------------------------|\n| Action not recognized | Action name not defined in Input Map | Add the action in Project > Project Settings > Input Map |\n| Fast repeated presses count once | `is_action_just_pressed()` polled in `_physics_process`; presses share one tick | Catch discrete actions in `_unhandled_input()` instead |\n| Input still fires when UI is open | Using `_input()` instead of `_unhandled_input()` | Switch to `_unhandled_input()` so UI consumes events first |\n| Mouse look works through menus | Mouse motion in `_input()` without mode check | Guard with `if Input.mouse_mode == Input.MOUSE_MODE_CAPTURED` |\n| Gamepad stick drifts | Deadzone too low or not set | Set deadzone per-action in Input Map (0.2 is a good default) |\n| Controller not detected | Not connected before game start | Connect `joy_connection_changed` signal, handle hot-plug |\n| Key rebinding captures modifier keys | No filter for Shift\u002FCtrl\u002FAlt alone | Skip events where keycode is a modifier key |\n| Touch input doesn't work on desktop | \"Emulate Touch From Mouse\" is disabled | Enable in Project Settings > Input Devices > Pointing |\n| Pause menu ignores input while paused | Node `process_mode` is `INHERIT` (pauses with parent) | Set pause menu to `PROCESS_MODE_ALWAYS` |\n| Action triggers twice per press | Same action checked in both `_input` and `_unhandled_input` | Pick one callback per action |\n| Alt+Enter toggles fullscreen twice (Godot 4.8+) | 4.8 adds the built-in `ui_toggle_fullscreen` action (Alt+Enter; Ctrl+Cmd+F on macOS), enabled by `display\u002Fwindow\u002Fsize\u002Fenable_toggle_fullscreen_shortcut` (default `true`) in every project | Remove the duplicate binding, or turn the setting off if your game handles fullscreen itself |\n\n> ⚠️ **Changed in Godot 4.7:** Mouse and keyboard device IDs changed from `0` to `InputEvent.DEVICE_ID_MOUSE` (`32`) and `InputEvent.DEVICE_ID_KEYBOARD` (`16`), because some joypads use `0` as their device ID. Code checking `event.device == 0` to detect keyboard\u002Fmouse input silently breaks — compare against the constants or check the event type (`event is InputEventKey`) instead. See the [4.7 migration guide](https:\u002F\u002Fdocs.godotengine.org\u002Fen\u002Flatest\u002Ftutorials\u002Fmigrating\u002Fupgrading_to_godot_4.7.html).\n\n---\n\n## 10. Implementation Checklist\n\n- [ ] All gameplay actions are defined in the Input Map — no raw keycodes in game logic\n- [ ] Discrete actions (jump, attack) use `_unhandled_input()`, not polling in `_physics_process()`\n- [ ] Continuous input (movement, sprint) uses `Input.get_vector()` \u002F `Input.is_action_pressed()` in `_physics_process()`\n- [ ] Mouse look guards on `Input.mouse_mode == MOUSE_MODE_CAPTURED` to avoid rotating through menus\n- [ ] Each Input Map action has both keyboard and gamepad bindings for controller support\n- [ ] Gamepad deadzone is set per-action in Input Map (new actions: 0.5 on 4.3, 0.2 from 4.4)\n- [ ] Pause menu node has `process_mode = PROCESS_MODE_ALWAYS` to receive input while paused\n- [ ] `get_viewport().set_input_as_handled()` is called after consuming events that shouldn't propagate\n- [ ] Input device detection exists if showing keyboard vs gamepad UI prompts\n- [ ] Key rebinding saves to and loads from `user:\u002F\u002F` on game launch\n","# Input Handling in Godot 4.3+\n\nAll examples target Godot 4.3+ with no deprecated APIs. GDScript is shown first, then C#.\n\n> **Related skills:** **player-controller** for movement driven by input, **godot-ui** for UI input focus and navigation, **save-load** for persisting custom key bindings, **responsive-ui** for touch vs desktop input adaptation, **xr-development** for XR controller and hand tracking input, **mobile-development** for mobile sensors and app lifecycle.\n\n---\n\n## 1. Core Concepts\n\n### Input Flow\n\n```\nHardware Event (key, mouse, gamepad)\n    ↓\nEngine converts to InputEvent\n    ↓\n_input()              ← raw input, runs first\n    ↓\nUI Control nodes      ← _gui_input: buttons, sliders consume events\n    ↓\n_shortcut_input()     ← for global shortcuts\n    ↓\n_unhandled_key_input() ← unhandled key-only events\n    ↓\n_unhandled_input()    ← game input (movement, actions)\n```\n\n### Where to Handle Input\n\n| Method | Use For | When It Runs |\n|---------------------------|--------------------------------------------|------------------|\n| `_input()` | Camera look, global hotkeys | First — before everything |\n| `_shortcut_input()` | Global shortcuts (pause, screenshot) | After UI, before unhandled |\n| `_unhandled_key_input()` | Key-only events that UI didn't consume | After UI, keys only |\n| `_unhandled_input()` | Gameplay actions (jump, attack, interact) | Last — after UI consumes |\n| `Input.is_action_pressed()` in `_physics_process()` | Continuous movement | N\u002FA — polling, not event-driven |\n\n**Rule of thumb:** Use `_unhandled_input()` for discrete game actions (jump, attack). Use `Input` polling in `_physics_process()` for continuous movement. Use `_input()` only when you need input before UI consumes it (e.g., mouse look).\n\n### InputEvent Hierarchy\n\n```\nInputEvent\n├── InputEventFromWindow\n│   ├── InputEventWithModifiers\n│   │   ├── InputEventKey            ← keyboard\n│   │   ├── InputEventMouse\n│   │   │   ├── InputEventMouseButton ← mouse clicks\n│   │   │   └── InputEventMouseMotion ← mouse movement\n│   │   └── InputEventGesture        ← Magnify \u002F Pan gestures\n│   ├── InputEventScreenTouch        ← touchscreen tap\n│   └── InputEventScreenDrag         ← touchscreen drag\n├── InputEventJoypadButton     ← gamepad buttons\n├── InputEventJoypadMotion     ← gamepad sticks\u002Ftriggers\n├── InputEventAction           ← synthetic action events\n├── InputEventMIDI             ← MIDI devices\n└── InputEventShortcut\n```\n\n---\n\n## 2. Input Map Setup\n\nDefine actions in **Project > Project Settings > Input Map** instead of checking raw keycodes. This decouples game logic from specific keys and enables rebinding.\n\n### Default Project Actions\n\nGodot ships with `ui_*` actions: `ui_accept`, `ui_cancel`, `ui_left`, `ui_right`, `ui_up`, `ui_down`, etc. These are used by UI controls for keyboard navigation. You can use them for gameplay but creating custom actions is preferred to avoid conflicts.\n\n### Adding Actions in Code\n\nActions can be created at runtime with `InputMap.add_action()` + `InputMap.action_add_event()` — typically in an autoload `_ready()`, guarded by `InputMap.has_action()`. Define actions in the editor Input Map; only add them in code for dynamically generated bindings or mod support.\n\n> See [references\u002Faction-rebinding.md](references\u002Faction-rebinding.md) for the GDScript and C# snippet.\n\n### Recommended Action Names\n\nUse descriptive, game-specific names instead of key names:\n\n| Good | Bad | Why |\n|---------------------|------------------|--------------------------------------|\n| `move_left` | `press_a` | Decoupled from physical key |\n| `attack` | `left_click` | Works for mouse and gamepad |\n| `interact` | `press_e` | Rebindable without changing logic |\n| `sprint` | `hold_shift` | Input-agnostic |\n| `pause` | `press_escape` | Can map to gamepad Start button too |\n\n---\n\n## 3. Reading Input — Events vs Polling\n\n### Event-Driven (Discrete Actions)\n\nUse `_unhandled_input()` for one-shot actions: jump, attack, interact, pause.\n\n#### GDScript\n\n```gdscript\nfunc _unhandled_input(event: InputEvent) -> void:\n    if event.is_action_pressed(\"jump\"):\n        _jump()\n        get_viewport().set_input_as_handled()  # prevent further propagation\n\n    if event.is_action_pressed(\"interact\"):\n        _interact()\n\n    if event.is_action_pressed(\"pause\"):\n        get_tree().paused = not get_tree().paused\n        get_viewport().set_input_as_handled()\n```\n\n#### C#\n\n```csharp\npublic override void _UnhandledInput(InputEvent @event)\n{\n    if (@event.IsActionPressed(\"jump\"))\n    {\n        Jump();\n        GetViewport().SetInputAsHandled();\n    }\n\n    if (@event.IsActionPressed(\"interact\"))\n        Interact();\n\n    if (@event.IsActionPressed(\"pause\"))\n    {\n        GetTree().Paused = !GetTree().Paused;\n        GetViewport().SetInputAsHandled();\n    }\n}\n```\n\n### Polling (Continuous Input)\n\nUse `Input` singleton in `_physics_process()` for held buttons and analog axes.\n\n#### GDScript\n\n```gdscript\nfunc _physics_process(delta: float) -> void:\n    # Movement vector from 4 directional actions\n    var direction := Input.get_vector(\"move_left\", \"move_right\", \"move_up\", \"move_down\")\n    velocity = direction * speed\n\n    # Check if a button is held\n    if Input.is_action_pressed(\"sprint\"):\n        velocity *= 1.5\n\n    move_and_slide()\n```\n\n#### C#\n\n```csharp\npublic override void _PhysicsProcess(double delta)\n{\n    Vector2 direction = Input.GetVector(\"move_left\", \"move_right\", \"move_up\", \"move_down\");\n    Velocity = direction * Speed;\n\n    if (Input.IsActionPressed(\"sprint\"))\n        Velocity *= 1.5f;\n\n    MoveAndSlide();\n}\n```\n\n### Key Input Methods\n\n| Method | Returns | Use For |\n|-----------------------------------|---------|--------------------------------------|\n| `Input.is_action_pressed()` | `bool` | Held buttons (sprint, crouch, fire) |\n| `Input.is_action_just_pressed()` | `bool` | One-shot triggers (jump, interact) |\n| `Input.is_action_just_released()` | `bool` | Release triggers (variable jump cut) |\n| `Input.get_action_strength()` | `float` | Analog pressure (0.0–1.0) |\n| `Input.get_axis()` | `float` | Single axis (-1.0 to 1.0) |\n| `Input.get_vector()` | `Vector2` | 2D direction, length capped at 1 |\n| `event.is_action_pressed()` | `bool` | Check in `_unhandled_input` callback |\n| `event.is_action_released()` | `bool` | Check in `_unhandled_input` callback |\n\n> **`Input.is_action_just_pressed()` in `_physics_process()` reports a press on the next physics tick**, even if the key was already released — a low tick rate does not drop taps, but several presses inside one tick count once. When each press matters, catch it in `_unhandled_input()` and set a flag.\n\n### Input Buffering\n\nBuffer discrete actions so a press made shortly before it can take effect (jump just before landing) still counts: catch the action in `_unhandled_input()`, set a flag with a short timer (0.1 s is typical), and consume the flag in `_physics_process()`.\n\n> See [references\u002Finput-buffering.md](references\u002Finput-buffering.md) for the full GDScript and C# jump-buffer implementation.\n\n---\n\n## 4. Mouse Input\n\n`InputEventMouseMotion.relative` for camera look (with `Input.MOUSE_MODE_CAPTURED`), `InputEventMouseButton` for clicks. Mouse modes: `VISIBLE`, `HIDDEN`, `CAPTURED`, `CONFINED`. Custom cursor via `Input.set_custom_mouse_cursor(texture, shape, hotspot)`.\n\n> See [references\u002Fmouse.md](references\u002Fmouse.md) for the full GDScript and C# recipes (camera-look with sensitivity + invert toggle, mouse-mode switching, button events, custom cursor with shape variants).\n\n---\n\n## 5. Controller \u002F Gamepad Support\n\n`Input.get_connected_joypads()` for runtime detection, `Input.joy_connection_changed` signal for hot-plug. Use Input Map actions with joypad button events for portability. Analog sticks: `Input.get_vector(\"left\", \"right\", \"up\", \"down\", deadzone)` returns a length-clamped Vector2 with built-in deadzone.\n\n> See [references\u002Fgamepad.md](references\u002Fgamepad.md) for the GDScript and C# recipes (controller detection, deadzone analog reading, vibration via `start_joy_vibration`, motion sensors, detecting last-input-device for UI prompt swapping).\n\n> **Changed in Godot 4.8:** Projects **newly created** in 4.8 set `input_devices\u002Fjoypads\u002Fignore_joypad_on_unfocused_application = true`: joypad input (including motion sensors) and LED changes are ignored, and vibration is stopped, while the window is unfocused. The class default stays `false`, so older and upgraded projects are unchanged. If a gamepad seems dead while testing with another window focused, or in a second-window local-multiplayer setup, check this setting.\n\n> **Godot 4.7+:** Joypad motion sensors — `Input.get_joy_accelerometer(device)` \u002F `get_joy_gyroscope(device)` (both `Vector3`), guarded by `has_joy_motion_sensors()` and enabled with `set_joy_motion_sensors_enabled()`; recipe in [references\u002Fgamepad.md](references\u002Fgamepad.md). Vibration is now queryable — `Input.has_joy_vibration(device)` plus `get_joy_vibration_strength\u002Fduration\u002Fremaining_duration()`. `JoyButton` gains `JOY_BUTTON_MISC2` (`21`) through `JOY_BUTTON_MISC6` (`25`) (C#: `JoyButton.Misc2`…). New project setting `input_devices\u002Fjoypads\u002Fignore_joypad_on_unfocused_application` (default `false`) ignores joypad input (including motion sensors) and LED changes and stops vibration while the app is unfocused.\n\n---\n\n## 6. Touch Input\n\n`InputEventScreenTouch` for tap\u002Frelease, `InputEventScreenDrag` for finger drag; multi-touch is tracked by `event.index`. To test on desktop, enable **Project Settings → Input Devices → Pointing → Emulate Touch From Mouse**; **Emulate Mouse From Touch** is on by default so UI works on touchscreens.\n\n> See [references\u002Ftouch.md](references\u002Ftouch.md) for the touch event recipes (GDScript and C#) and the `VirtualJoystick` on-screen stick (Godot 4.7+).\n\n---\n\n## 7. Action Rebinding at Runtime\n\nThree steps: (1) capture the user's chosen key via `_input` while in \"rebinding\" mode, (2) call `InputMap.action_erase_events(action)` then `InputMap.action_add_event(action, new_event)`, (3) persist via `ConfigFile` and reload on launch.\n\n> See [references\u002Faction-rebinding.md](references\u002Faction-rebinding.md) for the full GDScript and C# rebinding flow including ConfigFile save\u002Fload and the typical \"press a key\" capture UI.\n\n---\n\n## 8. Consuming and Propagating Input\n\nInput propagates in **reverse scene tree order** (the node lowest in the Scene dock first, root last); call `get_viewport().set_input_as_handled()` after consuming an event to stop it reaching other nodes. During pause, only nodes with `process_mode` `PROCESS_MODE_ALWAYS` or `PROCESS_MODE_WHEN_PAUSED` receive input.\n\n> See [references\u002Fevent-propagation.md](references\u002Fevent-propagation.md) for the GDScript and C# recipes (stopping propagation, node processing order, receiving input while paused).\n\n---\n\n## 9. Common Pitfalls\n\n| Symptom | Cause | Fix |\n|--------------------------------------|--------------------------------------------------|--------------------------------------------------------------------|\n| Action not recognized | Action name not defined in Input Map | Add the action in Project > Project Settings > Input Map |\n| Fast repeated presses count once | `is_action_just_pressed()` polled in `_physics_process`; presses share one tick | Catch discrete actions in `_unhandled_input()` instead |\n| Input still fires when UI is open | Using `_input()` instead of `_unhandled_input()` | Switch to `_unhandled_input()` so UI consumes events first |\n| Mouse look works through menus | Mouse motion in `_input()` without mode check | Guard with `if Input.mouse_mode == Input.MOUSE_MODE_CAPTURED` |\n| Gamepad stick drifts | Deadzone too low or not set | Set deadzone per-action in Input Map (0.2 is a good default) |\n| Controller not detected | Not connected before game start | Connect `joy_connection_changed` signal, handle hot-plug |\n| Key rebinding captures modifier keys | No filter for Shift\u002FCtrl\u002FAlt alone | Skip events where keycode is a modifier key |\n| Touch input doesn't work on desktop | \"Emulate Touch From Mouse\" is disabled | Enable in Project Settings > Input Devices > Pointing |\n| Pause menu ignores input while paused | Node `process_mode` is `INHERIT` (pauses with parent) | Set pause menu to `PROCESS_MODE_ALWAYS` |\n| Action triggers twice per press | Same action checked in both `_input` and `_unhandled_input` | Pick one callback per action |\n| Alt+Enter toggles fullscreen twice (Godot 4.8+) | 4.8 adds the built-in `ui_toggle_fullscreen` action (Alt+Enter; Ctrl+Cmd+F on macOS), enabled by `display\u002Fwindow\u002Fsize\u002Fenable_toggle_fullscreen_shortcut` (default `true`) in every project | Remove the duplicate binding, or turn the setting off if your game handles fullscreen itself |\n\n> ⚠️ **Changed in Godot 4.7:** Mouse and keyboard device IDs changed from `0` to `InputEvent.DEVICE_ID_MOUSE` (`32`) and `InputEvent.DEVICE_ID_KEYBOARD` (`16`), because some joypads use `0` as their device ID. Code checking `event.device == 0` to detect keyboard\u002Fmouse input silently breaks — compare against the constants or check the event type (`event is InputEventKey`) instead. See the [4.7 migration guide](https:\u002F\u002Fdocs.godotengine.org\u002Fen\u002Flatest\u002Ftutorials\u002Fmigrating\u002Fupgrading_to_godot_4.7.html).\n\n---\n\n## 10. Implementation Checklist\n\n- [ ] All gameplay actions are defined in the Input Map — no raw keycodes in game logic\n- [ ] Discrete actions (jump, attack) use `_unhandled_input()`, not polling in `_physics_process()`\n- [ ] Continuous input (movement, sprint) uses `Input.get_vector()` \u002F `Input.is_action_pressed()` in `_physics_process()`\n- [ ] Mouse look guards on `Input.mouse_mode == MOUSE_MODE_CAPTURED` to avoid rotating through menus\n- [ ] Each Input Map action has both keyboard and gamepad bindings for controller support\n- [ ] Gamepad deadzone is set per-action in Input Map (new actions: 0.5 on 4.3, 0.2 from 4.4)\n- [ ] Pause menu node has `process_mode = PROCESS_MODE_ALWAYS` to receive input while paused\n- [ ] `get_viewport().set_input_as_handled()` is called after consuming events that shouldn't propagate\n- [ ] Input device detection exists if showing keyboard vs gamepad UI prompts\n- [ ] Key rebinding saves to and loads from `user:\u002F\u002F` on game launch\n",{"name":5,"description":7},"master","60c28fdc40706a24576731e9fb3508b9c95258ad","skills\u002Finput-handling",63,"https:\u002F\u002Fgithub.com\u002Fjame581\u002FGodotPrompter","https:\u002F\u002Fgithub.com\u002Fjame581","https:\u002F\u002Fjanmesarc.online\u002F","Software engineer. My biggest passion is game development.","2026-11-14 20:45:49",{"source":8,"skillName":5,"commands":45,"prompt":55,"zipAvailable":56},[46,49,52],{"tool":47,"command":48},"npx","npx skills add jame581\u002FGodotPrompter --skill input-handling",{"tool":50,"command":51},"bunx","bunx skills add jame581\u002FGodotPrompter --skill input-handling",{"tool":53,"command":54},"pnpm","pnpm dlx skills add jame581\u002FGodotPrompter --skill input-handling","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjame581\u002FGodotPrompter\u002Fblob\u002Fmaster\u002Fskills\u002Finput-handling\u002FSKILL.md",true,[58,64,68,72,76,80],{"path":59,"resourceType":60,"resourceTypeDesc":61,"sizeBytes":62,"sourceHtmlUrl":63},"references\u002Faction-rebinding.md","REFERENCE","参考文档",6180,"https:\u002F\u002Fgithub.com\u002Fjame581\u002FGodotPrompter\u002Fblob\u002Fmaster\u002Fskills\u002Finput-handling\u002Freferences\u002Faction-rebinding.md",{"path":65,"resourceType":60,"resourceTypeDesc":61,"sizeBytes":66,"sourceHtmlUrl":67},"references\u002Fevent-propagation.md",1453,"https:\u002F\u002Fgithub.com\u002Fjame581\u002FGodotPrompter\u002Fblob\u002Fmaster\u002Fskills\u002Finput-handling\u002Freferences\u002Fevent-propagation.md",{"path":69,"resourceType":60,"resourceTypeDesc":61,"sizeBytes":70,"sourceHtmlUrl":71},"references\u002Fgamepad.md",6598,"https:\u002F\u002Fgithub.com\u002Fjame581\u002FGodotPrompter\u002Fblob\u002Fmaster\u002Fskills\u002Finput-handling\u002Freferences\u002Fgamepad.md",{"path":73,"resourceType":60,"resourceTypeDesc":61,"sizeBytes":74,"sourceHtmlUrl":75},"references\u002Finput-buffering.md",1614,"https:\u002F\u002Fgithub.com\u002Fjame581\u002FGodotPrompter\u002Fblob\u002Fmaster\u002Fskills\u002Finput-handling\u002Freferences\u002Finput-buffering.md",{"path":77,"resourceType":60,"resourceTypeDesc":61,"sizeBytes":78,"sourceHtmlUrl":79},"references\u002Fmouse.md",4510,"https:\u002F\u002Fgithub.com\u002Fjame581\u002FGodotPrompter\u002Fblob\u002Fmaster\u002Fskills\u002Finput-handling\u002Freferences\u002Fmouse.md",{"path":81,"resourceType":60,"resourceTypeDesc":61,"sizeBytes":82,"sourceHtmlUrl":83},"references\u002Ftouch.md",3625,"https:\u002F\u002Fgithub.com\u002Fjame581\u002FGodotPrompter\u002Fblob\u002Fmaster\u002Fskills\u002Finput-handling\u002Freferences\u002Ftouch.md",[85,105,126,155,179,196],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":30},"01M6KRFE5BR2PSD08ZKDAS66R7","xr-development","Use when building VR\u002FAR\u002FXR applications — OpenXR setup, XROrigin3D, hand tracking, controllers, passthrough, and Meta Quest deployment in Godot 4.3+","https:\u002F\u002Fgithub.com\u002Fjame581\u002FGodotPrompter\u002Fblob\u002Fmaster\u002Fskills\u002Fxr-development\u002FSKILL.md",[],[92,93,29,94,95,96,97,98,99,100,101,26,102,103,104],"xr development","development","deployment","godot","vr","setup","tracking","godot 4","ar","hand","Meta","applications","quest",{"skillNo":106,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":109,"categories":110,"keywords":111,"publishedAt":30},"01M6KRF8GZTG1TAS506MFBSGFC","web-services","Use when a Godot game calls a web server — HTTPRequest, downloads, REST\u002FJSON APIs, auth headers, WebSocketPeer clients, TLS, retries, and keeping secrets out of the build. Not for game networking\u002FRPCs (multiplayer-basics) or browser export (web-export)","https:\u002F\u002Fgithub.com\u002Fjame581\u002FGodotPrompter\u002Fblob\u002Fmaster\u002Fskills\u002Fweb-services\u002FSKILL.md",[],[112,113,114,115,116,117,118,119,26,29,95,120,121,122,123,124,125],"web services","web","services","tls","retries","calling","auth","downloads","clients","headers","secrets","json","build","REST",{"skillNo":127,"name":128,"nameZh":6,"description":129,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":130,"categories":131,"keywords":137,"publishedAt":30},"01M6KRF38Q4WSKAYFS56PG87T0","web-export","Use when shipping a Godot game to the browser — Web export preset options, threads vs no-threads and COOP\u002FCOEP headers, hosting on itch.io or your own server, PWA, JavaScriptBridge, user:\u002F\u002F persistence, audio and input limits, and load size","https:\u002F\u002Fgithub.com\u002Fjame581\u002FGodotPrompter\u002Fblob\u002Fmaster\u002Fskills\u002Fweb-export\u002FSKILL.md",[132],{"categoryNo":133,"categoryName":134,"taxonomyType":135,"taxonomyTypeDesc":136},"01JBSEEDCAT000000000000016","图像与多媒体","SCENARIO","使用场景",[113,138,139,140,141,142,143,144,121,145,20,29,146,147,148,149,150,151,26,152,153,154],"export","web export","threads","limits","shipping","size","options","hosting","Coop","preset","browser","game","io","load","pwa","Audio","server",{"skillNo":156,"name":157,"nameZh":6,"description":158,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":159,"categories":160,"keywords":169,"publishedAt":30},"01M6KREYFETEBH62ZTN6EZH2X3","using-godot-prompter","Bootstrap skill — establishes how to find and use GodotPrompter skills, with platform-specific tool mapping","https:\u002F\u002Fgithub.com\u002Fjame581\u002FGodotPrompter\u002Fblob\u002Fmaster\u002Fskills\u002Fusing-godot-prompter\u002FSKILL.md",[161,164],{"categoryNo":162,"categoryName":163,"taxonomyType":135,"taxonomyTypeDesc":136},"01JBSEEDCAT000000000000023","Skill与智能体开发",{"categoryNo":165,"categoryName":166,"taxonomyType":167,"taxonomyTypeDesc":168},"01JBSEEDCAT000000000000032","设计师","PROFESSION","适用职业",[95,170,171,172,173,26,174,175,176,177,178],"using godot prompter","find","with","bootstrap","tool","platform","mapping","how","how to",{"skillNo":180,"name":181,"nameZh":6,"description":182,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":183,"categories":184,"keywords":185,"publishedAt":30},"01M6KRER5G7EQWKGAFN8QJKQ69","tween-animation","Use when implementing tweens — property animation, method tweening, chaining, parallel sequences, easing, and common UI\u002Fgameplay motion recipes","https:\u002F\u002Fgithub.com\u002Fjame581\u002FGodotPrompter\u002Fblob\u002Fmaster\u002Fskills\u002Ftween-animation\u002FSKILL.md",[],[186,187,26,188,189,190,191,192,193,194,23,29,195],"tween animation","Animation","motion","parallel","gameplay","chaining","ui","recipes","common","sequences",{"skillNo":197,"name":198,"nameZh":6,"description":199,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":200,"categories":201,"keywords":202,"publishedAt":30},"01M6KREKGCQMVDV8WX7HWX8BZG","state-machine","Use when building a state machine or refactoring logic into one — enum, node, and resource-based FSM patterns with trade-offs. Not for adding states to an existing one","https:\u002F\u002Fgithub.com\u002Fjame581\u002FGodotPrompter\u002Fblob\u002Fmaster\u002Fskills\u002Fstate-machine\u002FSKILL.md",[],[203,204,205,95,29,206,207,208,209,210,172,26,23,211],"state","state machine","machine","patterns","node","fsm","state machines","trade","trade-offs"]