Joystick Plugin

Just found this. Any way to use this on 4.17?

WIth the changes that I posted in the three posts above, it should at least work in 4.16 (we have shipped a game with it), haven’t tried in 4.17 yet.

Hum, @Ikarus76 has not come to the UE4 forum for many months now.
But perhaps that you, @Till Riemer, could provide the above fix for 4.16 as a Pull Requests to its repository for everyone else to enjoy? (even if not merged, it would be useful to have it available online)
Cheers!

I’ve put the UE 4.18.0 changes to the plugin in our forked repo at GitHub - DescendentStudios/UEJoystickPlugin: Unofficial Joystick Plugin for the Unreal Engine

Hi,
i will update the plugins soon as possible. Hope till next week.
tsky

Cheers Jason Spangler, the plugin worked out the box for me (4:18.3) and has allowed me to use my joystick as a controller…

One question though, is it possible to be able to create a deadzone system for removing sporatic axis readings that basically cause unwanted movements? I

thianks for the updated versions which are usable in UE 4.18!
It works perfectly as it should, except for VR mode. I do not really understand why it is working in normal Editor View, but if I change to VR Preview (Oculus Rift) the Input from the joystick is not recognized anymore.

I really don’t know why its not working, any hints would really be appreciated because i am losing my mind :eek::eek:

Edit: Never Mind… the rift was the issue because it was in stand-by mode and so i did not receive Input… So the problem fixed itself when i put on the rift.
i just tested the Plugin in 4.19; can’t get it to work. if anyone has a updated version i would be happy if it would be shared

Hey, iam trying to fix the issue with 4.19. However, i can´t see a problem inside the Joystick.Plugin.cs since @JasonSpangler fixed the code for 4.18. If i try to generate Visual Studio Files it says Error and that UEBuildConfiguration is not Available in this context.

The problematic line is 75,17


if (UEBuildConfiguration.bBuildEditor == true)

There are some little information pieces here and there, but just can not resolve it. So please, whoever has the knowledge to fix it, please do it. And if also possible, some hints what caused the issue that would be great.

Is there maybe some primitive test projects to look at BPs? Links to test projects at github are dead. Thanks in advance!

Hi,
you can go to my repo (which DescendentStudios forked from). I updated the plugin and the links with an demo.
tsky​​​​​​​

Yes, Thank You! I am already using it on 4.19 since we discussed that on Youtube comments :slight_smile: It sees my Logitech Freedom flightstick just fine, and I map it, and use it. I also told my friends on Discord SciFi/Space/Aerial channel :slight_smile: Really, much appreciate that we have it and it is working nicely. When some day (not now) 4.20 released / matured, this plugin could go forward too, i hope?

Hey, I’ve added some basic force feedback support:

It’s just a very basic wrapper around SDL haptic functions, just enough to make things work. If someone wants to integrate it better, feel free to do so. :stuck_out_tongue:

Currently working effects: CONSTANT,SPRING,DAMPER,INERTIA,FRICTION,SINE,TRIANGLE,SAWTOOTHUP,SAWTOOTHDOWN,RAMP

Not supported yet: LEFTRIGHT (i don’t have anything to test it with), CUSTOM

Here it is: JoystickPlugin.zip - Google Drive

FFBdemo.zip - Google Drive and here it is with the demo project showing how to use it. If you have multiple controllers, don’t forget to change the controllerID

Hello, Tsky. May I ask for little help? I am investigating possibility to get joystick axis that are added thru your plugin to remappers. I am guessing, I have to use some axis status/name node that is exposed in Blueprints, but looking at Joystick Plugin nodes (your branches) I am kinda lost. I can get values, i can get joystick overall info, but i am not sure can i get axis status/name/something that can be introduced to re-binders in some menus Blueprints? Could you give some idea about this?
P.S.: thru your plugin, buttons registers in remappers no problem. Axis - they work, when set in Project Settings - Inputs, but they are not “seen” by remappers in Blueprints. I am guessing some node needs to be added.
I would really appreciate help on this, very much so. Thanks in advance!

Is now any update?

I’ve made some changes to the latest version of the plugin for UE4.22 to get it to compile on Ubuntu-18.04 LTS. I’m getting a linker error because it cant find Version.lib, which I think is a Windows Visual Studio library file.



[2/3] Link (ld) libUE4Editor-JoystickPlugin.so
/project/software/library/unrealengine-4.22/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v13_clang-7.0.1-centos7/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-ld: cannot find -lVersion.lib


This is a diff of the changes I’ve made to commit 4e6fc92c0e77364b70cbc0f7b58020584256fc68 in GitHub - tsky1971/UEJoystickPlugin: Unofficial Joystick Plugin for the Unreal Engine



diff --git a/Plugins/JoystickPlugin/Source/JoystickPlugin/Private/DeviceSDL.cpp b/Plugins/JoystickPlugin/Source/JoystickPlugin/Private/DeviceSDL.cpp
index 62e7578..0178c51 100644
--- a/Plugins/JoystickPlugin/Source/JoystickPlugin/Private/DeviceSDL.cpp
+++ b/Plugins/JoystickPlugin/Source/JoystickPlugin/Private/DeviceSDL.cpp
@@ -12,13 +12,26 @@
 #include <Engine.h>

 // @third party code - BEGIN SDL
+#define HAVE_IMMINTRIN_H 1
+#if PLATFORM_WINDOWS
+#if ENGINE_MAJOR_VERSION==4 && ENGINE_MINOR_VERSION==22
+#include "Windows/AllowWindowsPlatformTypes.h"
+#else
 #include "AllowWindowsPlatformTypes.h"
+#endif
+#endif

 #include "SDL.h"
 #include "SDL_joystick.h"
 #include "SDL_gamecontroller.h"

+#if PLATFORM_WINDOWS
+#if ENGINE_MAJOR_VERSION==4 && ENGINE_MINOR_VERSION==22
+#include "Windows/HideWindowsPlatformTypes.h"
+#else
 #include "HideWindowsPlatformTypes.h"
+#endif
+#endif
 // @third party code - END SDL

 DEFINE_LOG_CATEGORY(JoystickPluginLog);
diff --git a/Plugins/JoystickPlugin/Source/JoystickPlugin/Private/JoystickDevice.cpp b/Plugins/JoystickPlugin/Source/JoystickPlugin/Private/JoystickDevice.cpp
index 5e42709..1d64d1b 100644
--- a/Plugins/JoystickPlugin/Source/JoystickPlugin/Private/JoystickDevice.cpp
+++ b/Plugins/JoystickPlugin/Source/JoystickPlugin/Private/JoystickDevice.cpp
@@ -13,7 +13,11 @@

 #include <Engine.h>
 #include <SlateBasics.h>
-#include <Text.h>
+//#if ENGINE_MAJOR_VERSION==4 && ENGINE_MINOR_VERSION==22
+#include <Internationalization/Text.h>
+//#else
+//#include <Text.h>
+//#endif

 #define LOCTEXT_NAMESPACE "JoystickPlugin"

diff --git a/Plugins/JoystickPlugin/Source/JoystickPlugin/Public/IJoystickPlugin.h b/Plugins/JoystickPlugin/Source/JoystickPlugin/Public/IJoystickPlugin.h
index ec474c5..20d8b6f 100644
--- a/Plugins/JoystickPlugin/Source/JoystickPlugin/Public/IJoystickPlugin.h
+++ b/Plugins/JoystickPlugin/Source/JoystickPlugin/Public/IJoystickPlugin.h
@@ -2,7 +2,11 @@

 #pragma once

+#if ENGINE_MAJOR_VERSION==4 && ENGINE_MINOR_VERSION==22
+#include <Modules/ModuleManager.h>
+#else
 #include <ModuleManager.h>
+#endif
 #include <IInputDeviceModule.h>

 /**


getting a pretty odd issue when using a stick as an input axis with this, If i print out the axis outputs of the stick directly, it works fine, all as expected so sticks and the plugin’s core is working. But, through inputaxis, with only the one device bound to that axis, some frames it will double the inputaxis value at random. For example, looking at 5 frames: (Pitch left, yaw on right)

0.128208 | 0.999939
0.25544 | 0.991211
0.126621 |0.979247
0.251411 | 1.926389
0.124668 | 0.947264

Sometimes it only doubles one axis and sometimes doubles both… pretty confusing, i imagine it must be happening quite a bit maybe without other people noticing though? Been looking through the source but im not very familiar with this part of the engine and how the inputaxis polling might be double counting.

Edit: it is framerate dependent. If i limit framerate to 10 it sometimes multiplies the axis value, which is supposed to be at most 1.0, up to around 8. Obviously having axis inputs be framerate dependent is a bit of a nonstarter for an input plugin :s. I will continue to dig but i havent identified a cause yet.

Yes, i’m getting this bug too. I’m using axis directly instead of input events as a workaround.

Im not sure why exactly it multiplies the inputs, but it looks like this plugin is sending it’s inputs through Slate somehow before it gets to the inputevents. Im not sure why slate is being used, i looked at the steam controller and oculus plugins and they all use some seemingly more direct messaging system instead and that’s apparantly bypassing whatever is happening in slate that messes with the axis values.

It seems like it may be worth going in and reworking some of the plugin so that it communicates with input events through messaging instead of slate to fix that, but it would be a big task, and it would be nice to know why the original developers of this plugin chose to go through slate to begin with. Im not sure what decisions drove that design but there may be some pretty good reasons behind it.

Fixing this is a prereq for in-game axis re binding working, i finally got an axis rebinder working but with if using the event binds breaks the inputs its not very usable.

fixed the problem, now to dissapear into the ether… kidding.

after having another look tonight after letting this lie since my last post. I swapped the slate message system to the standard messaging system (that was a learning experience…) but it had no effect. Realized the problem was because of SDL updating at a different tick rate than the joystick module. This makes me worry that the SDL might update at a lower rate than the game tickrate sometimes, but i havent observed that happening yet, only a higher rate.

My version of the plugin is a disaster atm so i cant easily push the fix for now, but basically the dumb fix is to create a map of DeviceId to TArrays of axis values in the joystickdevice.h. For each axis (say in JoystickAxis()) get the array of the relevant deviceid and check of that axis is already in the array. If it is, do nothing. If not, send the axis event as usual then add the axis to the array. Then on tick, clear the array, this ensures each axis only gets added to once per tick. If anyone has better ideas or a way to lock the SDL’s update rate more properly, do contribute to the discussion.