I’m trying to use an XBox 360 controller in Windows, and I’m getting the single-axis trigger problem (explained here: DirectInput - Wikipedia ) where both trigger buttons are mapped to a single axis.
So does this mean that Unity is using DirectInput instead of XInput on Windows? Or is this happening because Windows Vista has installed a DirectInput driver for the controller instead of an XInput one? (I only plugged my controller in for the first time tonight, so I have no idea. I just let it install the default driver because that’s what most people will do.)
If it’s because Unity uses DirectInput, does that also mean that it’s impossible to fully support XBox 360 controllers on Windows, such as indendent trigger functionality or is there some other way?
Right, well I managed to remove the device and all trace of the default drivers, and I installed Microsoft’s XInput package this time.
Unfortunately, Unity still reads the triggers as the same (third) axis, which means you cannot read the triggers independently.
So it looks as though Unity is still using DirectInput for this, even though Microsoft recommend using XInput for current gen controllers. Given that Unity is developing an XBox 360 build, can we reasonably expect to see this fixed in the near future? It’s going to become pretty important to be able to test as close as possible to XBox 360 conditions on a PC.
Don’t see the relation.
Its microsofts fault for not offering drivers for the commonly used way to handle Input on Windows (DInput), not Unitys.
Thats what I wanted to say
(also I don’t see how XInput in Unity is related to a potential X360 Unity, as the later will require dev license and dev sdk which has its own way handling this kind of things and is independent from the desktop Unity similar to how iphone and wii are independent)
If I find missing functionality in a Microsoft development tool, I will report it to Microsoft. If I find missing functionality in Unity, I will report it to Unity Tech. If Unity Tech used a Microsoft development tool to develop Unity and they have a problem with it, I’m quite confident that they can talk to Microsoft about it.
They do offer DirectInput drivers. I’m using them. It’s just not the recommended way because the API is too old to support the full breadth of functionality.
It would hardly be a good advertisement for the 360 SDK if the controller didn’t work properly on Windows.
See the Wii Feature page as comparision.
Just because the Wii SDK is run on Windows, that does not mean that the regular Unity has Wii dedicated features, same goes for the X360 and XDK
But to get back on topic: DirectInput is much more complete and has many more features than the XInput x360 pad focused API MS has thrown out, nobody would focus on it. So to see if the problem is really DInput and not your code: Sure you are using the triggers correctly?
Because they are by design on one axis thats not a DInput thing but enforced this way by microsoft in their crapped DInput drivers.
DInput expects an analog stick to be in neutral position when nothing happens, but the x360 pads are at minimum in this case.
For this reason, one trigger starts at 0 and goes towards positive and the other starts at 0 and goes towards negative
so if you use them for racing games you can just use the resulting axis value as acceleration / break amount.
For more, check out the wiki page at DirectInput - Wikipedia which also mentions an alternative driver that fixes this “by intend MS generated trigger” problem, which leads to believe that MS did all to piss DInput to force devs to implement XInput if they want to get the “Games for Windows” certification. This again leads to the point that you should bomb MS support to finally get their DInput correct to the DInput standards instead of trashing them by intend.
Perhaps I’ve posted this in the wrong place. I’m new to the forums and believed that the support forum would be a good place to report a bug/missing feature. On further reflection, it does seem that posting on the forum has given the (incorrect) impression that I’m soliciting third party opinions, and I’m not. If I was, I would continue to correct all the factual errors in your replies, but since that was not my intent, I shall apologize for posting this in the wrong place.
If both triggers are affecting the same axis then this is a bug. Regardless of what Unity is doing behind the scenes this is undesired result. Best place to go with that is with the Bug Reporter. Posting to the forums doesn’t hurt, but won’t guarantee that UT will see it and will be open to discussion like the one you’re already having.