XInput.NET updated, now with proper dead zones support

Hey everyone,

It’s been a while since I’ve posted here, last time was to help Unity3D users to use the library I did back in 2009 for supporting the XBox 360 controller. As some may know, Unity doesn’t support separate triggers and vibration. I made this plugin nearly identical to the XNA Input API because it’s a really well designed API and some users may already be familiar with it.

I’ve opened up this project recently because someone complained that the dead zones made the sticks axis “snap”, there was a silly mistake in the code. I took the opportunity to rework the way the dead zones are computed and added a missing dead zones mode from the XNA API which was “Circular”.

I also moved the project from my personal site to GitHub so people can send me pull requests if they have fixes, feel free to play with the code : GitHub - speps/XInputDotNet: C# wrapper around XInput, works with any Mono or .NET application (eg. Unity3D)

Cheers,

Oh my ! Very good news !

I replaced the .dll in Plugins/ but I don’t think the Deadzone is in “Circular” by default. How do I change that in my project ?

Thanks !

At the line where you call GetState, you need to add a parameter and call it like this :

GamePad.GetState(playerIndex, GamePadDeadZone.Circular)

Working now. Thanks !

( You should add that line in the Example unity project on Github :slight_smile: )

I am from the fuuuutuuuuure~! I am still using this library, encountered the dead zone issue, and found this fix. 7-years-ago rmigillig, you rule!

OMG, I am even further from the future and this hint to the problem saved me.
I got some Deadzone Lock on my Controller Input and couldn’t figure out how to get rid of the Deadzone from XInput.

Luckily you can also remove the Deadzone Handling completely with

GamePad.GetState(playerIndex, GamePadDeadZone.None)

and handle the Deadzone somewhere else in code.