HarpSeal1 Posted September 14, 2019 Posted September 14, 2019 I'm trying to get an Xbox 360 controller to work in my project but I'm having trouble detecting buttons presses. Only 1 out of 20 or 30 presses is detected. The triggers and thumb sticks work just fine. I am calling this update function from AppWorldLogic's update function. public class XboxControls { ControlsXPad360 xpad; public XboxControls(){ xpad = new ControlsXPad360(0); } public void Update() { xpad.UpdateEvents(); if(xpad.ClearButton(ControlsXPad360.BUTTON_A) == 1) { Log.Message("A pressed"); } } } I'm using the .net core api and unigine 2.9. Any ideas? Thanks!
morbid Posted September 16, 2019 Posted September 16, 2019 Hello @HarpSeal1, We'll investigate this in a couple of days. Thanks. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
morbid Posted September 18, 2019 Posted September 18, 2019 In 2.9 we've changed input system and since this version you need these two classes: https://developer.unigine.com/en/docs/2.9/api/library/controls/class.input?rlang=cs https://developer.unigine.com/en/docs/2.9/api/library/controls/class.inputgamepad?rlang=cs This code will work: public class XboxControls { private InputGamePad xpad = null; public XboxControls() { if (Engine.input.CountGamePads != 0) xpad = Engine.input.GetGamePad(0); } public void Update() { if (xpad == null || !xpad.IsAvailable) return; if (xpad.IsButtonDown(InputGamePad.BUTTON.A)) Log.Message("Button down: A\n"); if (xpad.IsButtonPressed(InputGamePad.BUTTON.A)) Log.Message("Button pressed: A\n"); if (xpad.IsButtonUp(InputGamePad.BUTTON.A)) Log.Message("Button up: A\n"); } } Thanks. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
Recommended Posts