Hot answers tagged

17

The standard which you will find on most platforms is: Analog directional input left thumb Digital directional input left thumb Analog directional input right thumb 4 buttons right thumb 2 shoulder buttons left hand 2 shoulder buttons right hand 2 buttons in the center of the gamepad which are awkward to reach and should be used for special actions like ...


8

I've found a workable approach. I grabbed the DS4Tool source and copied the bits I needed into my Unity project so I could read the reports from the device directly. (That's the NativeMethods class to interface with Kernel32.dll, the device enumeration from HidDevices, and reading the report from the HidDevice class. I cut out the rest to keep things as ...


7

After a quick investigation it looks like you are missing some break; statements from your cases which results in flow-trough.


5

I'm going to let you in on a secret: float x = Input.GetAxis("JoymouseX"); float y = Input.GetAxis("JoymouseY"); Here we have input with two components, an x and a y. That's a vector! Vector2 input = new Vector2( Input.GetAxis("JoymouseX"), -Input.GetAxis("JoymouseY") ); (Here I negated the y, since I noticed ...


5

Most importantly: plan for remappable controls from the start. Different games use different conventions, and different players have different preferences. This is also important for accessibility - not everyone plays with the same hardware - electrically or biologically speaking - and the ability to remap controls can turn an impossible game into a ...


3

There are a couple setups that have become ubiquitous. Here are some common uses (non-exhaustive list): Left stick for Player movement Top-down shooters: Movement direction Clicking: Ducks Right Stick for Camera movement Top-down shooters: Shooting direction Clicking: Cycles zoom levels Centers the camera on the player Dpad: Player movement Side-...


3

According to the FCC instruction filing for Stratus XL, the center round key is intended to be a home key. If that's correct, there might not be much you can do, as the developer reference for the home key states: KEYCODE_HOME added in API level 1 int KEYCODE_HOME Key code constant: Home key. This key is handled by the framework and is never delivered ...


3

As we can infer from the problem you are actually explaining, yes. You can most certainly use a steering wheel controller. The problem you face is in your assumption of how the axis and buttons will be handled, in the first place. To give a better example, let's take a look at the Xbox 360 controller, courtesy of the Unity 3D Wiki: As you can see from the ...


2

I've created a solution to this myself. It's called JoyShockLibrary, and reads from DualShock 4, Switch Pro Controller, and Joy-Cons. It's open source, MIT license, and works well, although Bluetooth support for the DS4 was only added recently and is still improving. It's used in JoyShockMapper, which is an input-mapping tool, and JoyShockOverlay, which isn'...


2

Tl;dr: There are about 4 categories. If you want to support many gamepads simply target the XBox layout. If you want to support all gamepads make sure your game can be controlled with the SNES layout (which is a subset of XBox), and allow the user to remap the controls, and also allow them to map any additional buttons and axes their gamepad may have. Of ...


2

Windows lacks DirectInput support for DS4 gamepads. In general there's no standard way to do haptics for HID gamepads, and the DS4 isn't even really a standard HID gamepad. To get this working in Chrome I had to send the vibration commands as raw HID packets: https://cs.chromium.org/chromium/src/device/gamepad/dualshock4_controller_base.cc?l=45 https://cs....


2

The general rule of thumb in game design is that it is better for a game to feel right than to be right. So smoothing out the gun movement can be a viable method to make it appear less twitchy. I am not sure, though, if using a proportional–integral–derivative controller is the best technique here. Have you considered just taking the average of the past few ...


2

For reference, hid-steam maps Steam Controller inputs to these input events: ABS_HAT2Y: left trigger ABS_HAT2X: right trigger ABS_X/ABS_HAT0X: X value ABS_Y/ABS_HAT0Y: Y value ABS_RX: right-pad X value ABS_RY: right-pad Y value BTN_TR2: right trigger fully pressed BTN_TL2: left trigger fully pressed BTN_TR: right shoulder BTN_TL: left shoulder BTN_Y: button ...


1

Well, I was unable to reproduce the problem using Unity 2020.3.11f1 and my own gamepad (Cheap XBox 360 compatible gamepad by Speedlink). I used the Input Manager to create 7 axis inputs and mapped them to the Joystick axis X, Y, 3, 4, 5, 6 and 7 "from all Joysticks". I then created a script to visualize those 7 axis' on the canvas. The result ...


1

After a little work I was able to come up with the following C++ framework, which uses the article found here https://docs.microsoft.com/en-us/windows/win32/xinput/getting-started-with-xinput. I found this to work with my XBox gamepad controller. Compiled on Visual Studio 2019 GamePad.h #incldude <xinput.h> class GamePad { public: GamePad(); ...


1

The new input system offers the option to handle a directional pad as both a two-axis analog input or as four separate digital button inputs. And if necessary even both at the same time. The class DPadControl implements both Vector2Control itself and also has four ButtonControl members for the four directions. So you can access its state both like this: if (...


1

but the Dpad is limited to axises and won't actually work as individual buttons. This is by design. If you want to do something specific when a D-pad direction is pressed, you can do so the same way that you would detect if a player had pushed their thumbsticks up, or left, or right, or down. You need to check what direction, if any, each dpad axis is ...


1

A common approach to the issue of "taking control" is to treat a controller as it's own entity within the game, and have objects with a Possessable script. The idea is the following: You query input from a Possessable. For example in your car controller public Possessable Possessable; private void Update() { if (!Possessable.Possessed) return; if (...


1

You always have the option of slowing down the responsiveness, by limiting hte speed at which the character can turn as you mentioned; but there is also another possibility if the game play is feeling 'perfect' with the current responsiveness: You could instead slow down the animation to blend better while maintaining the game play responsiveness, for ...


1

Unity treats the L2 and R2 buttons as an axis rather than a button. From the answer on this post: Create an input named "R2" set the gravity to 1.5, dead zone to 0.3, and the sensivity to 1.1, then use "Joystick Axis" for the type and have it use "10th Axis (Joystick)" for the Axis. And that should work using Input.GetButton("R2") Or you can set up the ...


1

The WMRotation variable you have here is being used to drive the rotation. The rotation is changing in response to the thumbsticks because you have some logic in your update that is modifying the WMRotation variable in response to thumbstick input. If you were to remove this logic and just add a small amount to WMRotation every update, then the image ...


Only top voted, non community-wiki answers of a minimum length are eligible