Search the Community
Showing results for tags 'xbox'.
-
Hi, I’ve setup a project to use the Xbox controller for player controls. I’ve done this using the ControlsXPad360 class to get the controller input and the set the control states for the player based on the game pad input like so: int leftThumbstickX = (int)gamepad.getLeftX(); if (gamepad.getLeftX() > 0.25) leftThumbstickX = 1; else if (gamepad.getLeftX() < -0.25) leftThumbstickX = -1; else leftThumbstickX = 0; if (App.get().getKeyState(ControlsApp.get().getStateKey(Controls.STATE_MOVE_RIGHT)) == 0 && leftThumbstickX >= 0.1f) { controlsRef.setState(Controls.STATE_MOVE_RIGHT, leftThumbstickX); } The problem with this is setState only takes an int so you lose the analogue values and fine movement controls for the player. I’ve started to look at the following information in the documentation: https://developer.unigine.com/en/docs/2.7.1/code/uniginescript/scripts/input Is this the correct way to use the gamepad with a player? I’ve created a short xml to test this but in the Unigine script file that was created when I created the test project when I do Step 4 and add the code to load the xml controls: Control control = new Control(); control.loadFromFile("Input.xml"); and then run the project, the world no longer loads and I get the attached error, without this code it runs fine. Can you advise on the correct way to implement xbox controller controls for a player while maintaining the analogue input? Thanks, Marc.
- 5 replies
-
- input
- input system
-
(and 2 more)
Tagged with: