- Home /
Trouble with input manager with Joysticks (logitech g27)
Hello everyone!
I am using the logitec G27 set (steering wheel,pedals and gear). I am able to get input from steering wheel and 2 pedals, and can not get input from the gear joystick.
I tried all axes with all combination of joystick numbers. Has anyone used or tried this? Its making me sick:@ please check the attached image
Answer by moghes · Apr 10, 2013 at 03:12 PM
Well after 2 days I did solve this issue, it was simple but still I couldn't find any direct answer.
The wheel and the pedals are considered as axis , but the gears as buttons . iwaldrop was right.(but how to get input from those buttons).
to get input from the gears, I had to put "joystick number 8", "joystick number 9" ... in the field "Positive button", and get the input by:
Input.GetButton("1stGear"));
while getting input from the wheel was like :
Input.GetAxis("Horizontal"));
to check what joystick number I simply tested all one by one.
check the attached picture.
and get the input, for example:
hi, @moghes I am working on something like you did but I have a problem with the brake pedal and the reverse gear. I hope you help me and tell me how can I do it. Waiting for your answer. Thanks
hi, @moghes I am working on something like you did but I have a problem with the brake pedal and the reverse gear. I hope you help me and tell me how can I do it. Waiting for your answer. Thanks
Can i ask you a couple of questions, did you have to add any files to your project for this to work (like xinput for example) , when you move in to first gear is it pressed one time or is it pressed all the time, and is neutral gear also recognized.
Answer by iwaldrop · Apr 05, 2013 at 06:20 PM
It's likely that the gear lever isn't an axis, but a two or more buttons (depending on it being a vertical or gated shifter). So, check for button presses, not axis changes.
@iwaldrop thanks for the reply, so for the input type, there's 4 possible types. so if its not the "Joystick Axis" then it must be "key or mouse button".. I did put key or mouse button, and couldn't read any input with Input.GetButton("gear"));
and Input.GetButtonDown("gear"));
... it seems soo strange .. but I think the type has to be Joystick Axis
For things like this you must brute-force your way into finding what the buttons are. Create a bit of code that listens to every single possible joystick input and watch the activity when you use the gear switch.
I agree with Loius' comment, and it is something I've done myself. You'd be surprised how useful something like that can be, because you can use it again on a new project or when you're trying to support a new input device.
Well I've got CustomInput on the asset store that does it for you, but...
for ( var joystick : int = 1; joystick < 5; joystick++ ) {
for ( var button : int = 0; button < 20; button++ ) {
if ( Input.Get$$anonymous$$ey("joystick " + joystick + " button " + button) ) {
// that's the right button, now i need to assign a $$anonymous$$eyCode to list[ix]
list[ix] = System.Enum.Parse($$anonymous$$eyCode, "Joystick"+joystick+"Button"+button);
got$$anonymous$$ey = true;
}
}
}
Listening to axes is stupid because Unity is stupid :V and won't expose the Input class to scripting. You have to create every possible joystick axis as a separate input in the Input manager and then scan them all and watch for nonzero values.
for ( var axis : String in myAxes ) {
if ( Input.GetAxis( axis ) ) {
Debug.Log("You're moving " + axis);
}
}
... I only just now realized that joystick numbering starts at one and button numbering starts at zero. AAAARRRRGH
Your answer
![](https://koobas.hobune.stream/wayback/20220613095743im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
multiple gamepads not recognized or weren't successfully installed 1 Answer
How do I controll a Character using the Mecanim Animator with Player Joysticks? 2 Answers
How can I able to get the Joystick movement values (Axis 6 and 7 ) in Android ..?, 0 Answers
Get x/y joystick axis from hatswitch? 0 Answers