Open grimtin10 opened 1 year ago
i dont know why this doesnt have the bug label
Homemade joysticks likely require you to provide your own mapping, as described in the documentation.
i dont know why this doesnt have the bug label
Labels are assigned by volunteers after issues are created. They are not automatically assigned based on issue contents.
i dont even do anything with the joystick is the thing, godot just starts complaining (i am very new to godot)
i also want to avoid making mappings myself because of the wide variety of joysticks custom and not custom so i want the user to be able to map it themselves
Hello Grimtin10! I'm currently working on a project with Godot / Arduino Controller as well.
Did you make sure to exclude undefined buttons in your controller or Arduino Code? This can cause issues with values read wrong by the OS device interface and Godot starts to complain about invalid values.
If so, this might actually not be a Godot related bug but a setup issue with the controller.
For the arduino joystick library by Matthew Heironimus you have to do the following:
(in your Arduino code)
//taken from the "GamepadExample" included with the library
include
//define what buttons or sticks you actually use here:
Joystick_ Joystick(JOYSTICK_DEFAULT_REPORT_ID,JOYSTICK_TYPE_GAMEPAD, 1, 0, // Button Count, Hat Switch Count true, true, false, // X and Y, but no Z Axis false, false, false, // No Rx, Ry, or Rz false, false, // No rudder or throttle false, false, false); // No accelerator, brake, or steering
void setup() { //etc. }
I included a example picture of what the controller should look like in your device manager - if you see buttons or sticks you didn't map in your code, those will likely cause issues. I only connected an analog stick with two axis here in the example. This procedere fixed the issue for me.
You also don't have do define custom controllers for easy use cases like two or three analog sticks and a few buttons... Godot should map those in an appropriate manner to the "presets" (e.G. Joypad Axis 0 - Left Stick Left).
Godot version
4.1.1.stable.mono.official
System information
Godot v4.1.1.stable.mono - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1080 Ti (NVIDIA; 31.0.15.3713) - AMD Ryzen 7 3700X 8-Core Processor (16 Threads)
Issue description
Plugging in joystick using arduino joystick library by Matthew Heironimus causes error
core/input/input.cpp:1046 - Index (int)p_axis = 10 is out of bounds ((int)JoyAxis::MAX = 10).
The joystick has 32 buttons.Steps to reproduce
Make joystick using Arduino and joystick library by Matthew Heironimus (or one with >10 buttons) Plug it in while Godot is open Console will get spammed with errors
Minimal reproduction project
An empty project will work. If it doesn't just add one script.