j.barouh Posted May 26, 2015 Share Posted May 26, 2015 Hi, I am trying to use the Unigine input system (with SDK 2.0-beta2). I managed to display the Unigine::Input::ControlSetupWindow in my project and save keyboard and mouse inputs in the XML control file I created. My problem is, I failed saving joystick inputs. I have an XBox 360 gamepad which is correctly recognized : I made a debug widget which displays the status of the pad to make sure of that. I have been diging in the scripts\input folder to try to understand the problem : I saw that the inputs of the pad are correctly registered in the device manager, but it seems their status is not updated there and I don't understand why. I guess I am missing something and I would appreciate any help. Another little question : when I click on my status widget (or anywhere outside the game area), the pad becomes "unavailable". Is there a way to fix that ? Thanks ! Link to comment
silent Posted May 27, 2015 Share Posted May 27, 2015 Hi Jonathan, Can we take a look at your code? You can attach simple test scene with *.cpp and *.world files to your response. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
j.barouh Posted May 27, 2015 Author Share Posted May 27, 2015 Sure, here is my small project. The calls to the ControlSetupWindow are in CMappingWindow.h Thanks ! InputSystemProject.zip Link to comment
maxi Posted May 28, 2015 Share Posted May 28, 2015 Hi, Jonathan. You are not missing anything, it's a bug. You can use this patch as a workaround. input.zip Link to comment
j.barouh Posted May 29, 2015 Author Share Posted May 29, 2015 Great, Maxim ! I tried it and it almost works : axis and buttons of the controller are recognized, but not the d-pad. There is also a bug with the buttons : if I bind one to an action with the ControlSetupWindow, the next time I try to bind a control, the input dialog acts as if the button is still pressed even if it's not. Thanks again ! Link to comment
maxi Posted June 1, 2015 Share Posted June 1, 2015 Hi, Jonathan! Use attached input.patch to fix this. And use ControlsXPad360 instead of ControlsJoystick for xbox 360 pad in CInputManager. If you will have "cannot load xinput1_4.dll" use ControlsXPad360.cpp.patch. Unigine.zip Link to comment
j.barouh Posted June 10, 2015 Author Share Posted June 10, 2015 Hi Maxim, sorry I did not reply sooner, I had to work on another project for a while. It seems the input.patch file you sent is the same as the last time. I had already applied it, then created a new project with the modified SDK and then copied my code in it (I don't know if it's the best way to do it). The pad was detected in the ControlSetupWindow unlike before, but then there were the other bugs. Today, I tried it with another controller, a Logitech G25 racing wheel. Its d-pad is recognized, but there is the same bug with the input dialog, where the last button pressed when defining an action is still detected as pressed when defining another action. Link to comment
maxi Posted June 11, 2015 Share Posted June 11, 2015 Hi, Jonathan! Sorry, I have uploaded wrong patch. I've attached input files with ControlsXPad360.cpp.patch, try it. input files.zip Link to comment
j.barouh Posted June 12, 2015 Author Share Posted June 12, 2015 Hi Maxim, It seems to work perfectly with the XPad, good job ! There's still a little issue with the G25, I didn't see it before : when trying to enter an input for an action, the pedals are immediately detected. This is because they are not regular joystick axis, regarding their range and their neutral value. I had no luck trying to fix this so far but I'll keep you posted if I find a solution. Thanks again. Link to comment
j.barouh Posted June 12, 2015 Author Share Posted June 12, 2015 I made a special case for the pedals in InputDialog::init_inputs() : they only get a "negative" Input where the other axis have a positive and a negative Input. I'm not sure it's the best solution but it works for now ! Link to comment
j.barouh Posted June 18, 2015 Author Share Posted June 18, 2015 For the record, I had another problem when I tried to get the state of the actions (in Unigine::Input::Control::actions). The states wouldn't change when using the inputs bound to the actions. It turned out I always ended in a case which forced the state to be neutral. In the getState() function of the Unigine::Input::Action class, there is this : if(def.lockable && (engine.gui.getActivity() == 1 || engine.app.getMouseGrab() == 0)) { return getNeutral(); } I didn't really understand why this test was always true for me, but I commented this part so I could move forward. Then I could get the states of the actions bound to a mouse or keyboard input, but not to a joystick input. I finally realized this was the same issue as in the input dialog, which you corrected with the patches : the input devices were not updated. So in the update() function of the Unigine::Input::Input class, I added this (after the first test on input_device) : input_device.update(); Now everything seems to work ! Link to comment
maxi Posted June 22, 2015 Share Posted June 22, 2015 Hi, Jonathan, Thank you for helping us finding bugs! In getState function must be: if(def.lockable && (engine.gui.getActivity() == 0 || engine.app.getMouseGrab() == 0)) And instead of calling input_device.update() in Unigine::Input::Input::update() better call Unigine::Input::update in world script update function. Link to comment
j.barouh Posted June 25, 2015 Author Share Posted June 25, 2015 Ok thanks for the corrections, Maxim ! Link to comment
Recommended Posts