Skip to content

Add joy axis input map binding#479

Merged
dsarno merged 2 commits into
hi-godot:mainfrom
Clubhouse1661:fix-input-map-joy-axis
May 28, 2026
Merged

Add joy axis input map binding#479
dsarno merged 2 commits into
hi-godot:mainfrom
Clubhouse1661:fix-input-map-joy-axis

Conversation

@Clubhouse1661

Copy link
Copy Markdown
Contributor

Summary

Fixes #465 by adding support for binding joystick axis events through input_map_manage(op=bind_event).

  • Add event_type=joy_axis support in the GDScript input handler by creating InputEventJoypadMotion.
  • Require axis and accept optional axis_value (default 1.0).
  • Update MCP tool docs to advertise joy_axis alongside key, mouse button, and joy button bindings.
  • Add GDScript coverage for missing axis and successful axis binding.

Verification

  • Red check before implementation: focused input suite failed on test_bind_joy_axis_event because joy_axis returned an error instead of data.
  • test_run suite=input: 22/22 passed, 0 failed.
  • python -m ruff check src/godot_ai/tools/input_map.py: passed.
  • git diff --check: passed.

@codecov

codecov Bot commented May 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Clubhouse1661 Clubhouse1661 marked this pull request as ready for review May 28, 2026 01:45
@dsarno dsarno requested a review from Copilot May 28, 2026 16:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses #465 by extending the InputMap MCP “bind_event” pathway to support joystick axis bindings (event_type="joy_axis") in the Godot-side input handler, along with docs and tests. From code inspection, input_map_manage(op=list) already serializes both joy button and joy axis events (and user-authored/custom actions persisted in project.godot), so the prior “read dropped joy events / custom actions” report is likely due to filtering (include_builtin=false) or the project lacking persisted [input] entries rather than missing serialization.

Changes:

  • Add joy_axis handling to InputHandler._create_event() by creating InputEventJoypadMotion and requiring axis (with optional axis_value defaulting to 1.0).
  • Update the MCP tool description to document joy_axis bindings and parameters.
  • Add GDScript tests covering missing axis validation and successful joy_axis binding/serialization.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
plugin/addons/godot_ai/handlers/input_handler.gd Adds joy_axis event creation and updates unsupported-type messaging.
src/godot_ai/tools/input_map.py Documents joy_axis support and new parameters for bind_event.
test_project/tests/test_input.gd Adds tests for missing axis and successful joy-axis binding.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread plugin/addons/godot_ai/handlers/input_handler.gd Outdated
@dsarno dsarno merged commit 3537817 into hi-godot:main May 28, 2026
15 checks passed
@Clubhouse1661 Clubhouse1661 deleted the fix-input-map-joy-axis branch May 28, 2026 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incomplete input mapping for the MCP

3 participants