Raw input (Joystick and HOTAS support)

While I was experimenting with implementing mechanics for spaceship movement, I discovered (quite late) that Unreal doesn’t natively support joysticks. Originally, I thought, if Unreal supports gamepads, and the much rarer motion controllers, it should support joysticks. But I was wrong. So I searched around and found the Raw Input plugin. This plugin does work, except that all axes go from 0 to 1 (with 0.5 at rest) as opposed from -1 to 1. The only thing I can do is offset the axes in the Raw Input settings to go from -0.5 to 0.5. On top of that, when I have both the Joystick and HOTAS connected, some axes work, while others become unstable and show weird numbers when debugging. The plugin also seems to only support 20 buttons, which causes some buttons of the HOTAS and stick to overlap. The POV Hat also shows as an axis with strange numbers (even though it’s like the D-pad on a controller with 8 instead of 4 buttons). Disabling unused axes from both devices causes only the axes from the first connected/discovered device to work, with the axes of the other device overlapping with the first axis.

I have a Thrustmaster T.16000M FCS with the matching TWCS HOTAS as a set, which I use for space games such as Elite Dangerous. Simply put, is there a way to make these input devices work? Can the Raw Input plugin be modified to support this, or would I have to create a custom input plugin? Even though my C++ skills are gradually increasing it’s not there yet, so how difficult would it be to take the existing plugin and modify it to properly support at least these two devices, and in the future, others?

1 Like

check if you are not receiving packed data, eg what you observe and evaluate as error might be packed values of multiple buttons to bits

How exactly do I do that? I mean, the plugin uses a single input type “Generic USB Controller”, and has a maximum of twenty buttons, whereas the stick and HOTAS together have more buttons. So, if the inputs are packed, how do I set up the inputs so Blueprint/C++ knows which to use? There’s not a lot of configuration options with the plugin. If only I could create my own input types to isolate the Joystick and HOTAS buttons and axes, and normalize the inputs from 0 to 1, to -1 to 1 (right now, I can only offset the range and not scale it).

There is free unofficial joystick / flightstick, you can play around with that. It works for me. I take plugin folder from example project and put it into my project, and it shows up in plugins, and is working (all flightstick axis and buttons are available in “Project settings - Inputs”. This:

For any future users, who would like to process|parse raw input of the Thrustmaster POV hat.
The POV hat uses Degrees as it’s axis rate, but the ‘default’ state returns a rate which exceeds the max value, so ‘0’ can be North.



if (Rate > 2.0f) return;
Rate = FMath::DegreesToRadians(Rate * 100.0f);
// Rate = 0.0|UP, 0.25|RUP, 0.5|R, 0.75|RDN, 1.0|DN, 1.25|LDN, 1.50|L, 1.75|LUP


I realize you’ve moved on long ago, but for anybody else looking into this stuff:

If you go to project setting and look for “Raw Input” way down at the bottom. In there you can check the “Gamepad Stick” box for each axis you want to use. This will change the default 0 to 1 input to a -1 to 1 input for that axis.

2 Likes

in order to convert from (0 to 1) to (-1 to 1) multiply by 2 and subtract 1.

(-1 to 1) to (0 to 1) is add 1 then divide by 2.