Joystick Plugin

I have the plug in installed, and input mapping appear in engine-input (I am using Thrustmaster HOTAS X)

I have tried adding in pawn and level (add register for joystick events etc) but i get nothing. In mappings it states the buttons when selecting, but once selected they all say joystick T if that makes any difference.

Even in the test projects, The plug in shows up, but my HOTAS is not doing anything. The control panel shows its working but nothing in U4 editor or packaged game.

Hi, I know it’s an old question, but I’m would also like to implement forcefeedback(DirectX DirectInput for old MS FFB2 Joystick ForceFeedback Effects.

Unfortunately it seems, that SDL 2.0 removed the DirectInput FF implementation. Did you make any Progress on this?

This is an image of the mapping. As soon as i select the named one, it reverts to Joystick_T as in the image. is this normal?

642359532a2084f192d9fd26f2bf6e21cde428a1.jpeg

It’s that bug I mentioned earlier. This plugin doesn’t work if there’s a dot in device name. For a temporary fix, go to joystickDevice.cpp, replace


DeviceInfo.DeviceName = DeviceInfo.ProductName.Replace(TEXT(" "), TEXT(""));

with



DeviceInfo.DeviceName = DeviceInfo.ProductName.Replace(TEXT(" "), TEXT(""));
DeviceInfo.ProductName = DeviceInfo.ProductName.Replace(TEXT("."), TEXT(""));
DeviceInfo.DeviceName = DeviceInfo.DeviceName.Replace(TEXT("."), TEXT("")); 

and recompile it.

Thanks, Ill give that a try :slight_smile:

Thanks moookiexl :slight_smile: That did the trick

I have the joystick all working great in game. The only problem I am getting is using a button with UMG. I am using the basic onclicked event and also tried the on pressed event. These are working fine for the controller, but how do i make a joystick button work with it?

I have tried the keyup and keydown, but these dont work either, they work fine for controller.

Is this plugin still actively maintained?

Just curious because I am looking for a joystick plugin that can handle various joystick configurations.

Edit: Looks like it is. GitHub - tsky1971/UEJoystickPlugin: Unofficial Joystick Plugin for the Unreal Engine

Yup. I just updated to 4.13

Looks like - SDL 2.0.4 will be part of Unreal Engine 4.14 :slight_smile:

https://github.com/EpicGames/UnrealEngine/pull/1920

Hi guys, thanks for all this effort ! I’m currently working on joystick support in my game and this proved super helpful.

Hi guys. I have completed joystick support in my game. I think I’ve found two issues in the plugin so far, from GitHub - tsky1971/UEJoystickPlugin: Unofficial Joystick Plugin for the Unreal Engine .

  • First issue is known : dots in device name break it. The fix mentioned earlier works but the repo doesn’t have it.
  • Second issue is initialization. If you have a thrust level on the joystick and leave it in a non-zero position, for example, axis input in the game will be zero until you move. Then the actual value will be sent.

I have put “plugins” into UE Project root and restarted the Editor.
0.png
But i couldn’t find the “Joystick” anywhere.For example ClassViewer BluePrint Input.

What should i do?Any idea please!!!

You put it in Contents but should put it in root directory (testUE4/Plugins/…PluginName…)

Thanks!I have put it in the correct place.And set the plugin enable


but i couldn’t find the “Joystick” anywhere.
When i open Input mapping viewClass AddComponent,i can’t search “Joystick”,just like this:
![O5Y4Z0HYFG2}TQJE19$N8K.png|676x591
QQ截图20170110143413.png
Anyway other people’s editor have the joystick which i find in forum ,just like this:
![]L~0BI)JIB}]L4P]%1_799.png|480x298

QQ截图20170110144019.png
what’s wrong with it?

In 4.15.1

Безымянный34.png

Please tell me how to connect two joysticks. For two players (for game Fighting)

Anyone using this plugin with 4.16 will have to update the plugin’s build.cs:




namespace UnrealBuildTool.Rules
{
	using System;
	using System.IO;
	using System.Collections.Generic;

	public class JoystickPlugin : ModuleRules
	{
		// UE does not copy third party dlls to the output directory automatically.
		// Link statically so you don't have to do it manually.
		private bool LinkThirdPartyStaticallyOnWindows = true;

		private string ModulePath
		{
            get { return  ModuleDirectory; }
        }

        private string ThirdPartyPath
		{
			get { return Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/")); }
		}

		private string BinariesPath
		{
			get { return Path.GetFullPath(Path.Combine(ModulePath, "../../Binaries/")); }
		}

		public virtual void SetupBinaries(
			TargetInfo Target,
			ref List<UEBuildBinaryConfiguration> OutBuildBinaryConfigurations,
			ref List<string> OutExtraModuleNames
			)
		{
			//OutBuildBinaryConfigurations.Add(
				//new UEBuildBinaryConfiguration(UEBuildBinaryType.DynamicLinkLibrary, InTargetName: "SDL2.dll"));
		}

		public JoystickPlugin(ReadOnlyTargetRules Target) : base(Target)
		{
			PublicDependencyModuleNames.AddRange(
				new string]
				{
					"Core",
					"CoreUObject",
					"Engine",
					"InputCore",
					"Slate",
					"SlateCore",
					// ... add other public dependencies that you statically link with here ...
				});

			PrivateIncludePathModuleNames.AddRange(
				new string]
				{
					"InputDevice",
				});

			if (Target.Type == TargetRules.TargetType.Editor)
			{
				PrivateIncludePathModuleNames.AddRange(
					new string]
					{
						"PropertyEditor",
						"ActorPickerMode",
						"DetailCustomizations",
					});

				PrivateDependencyModuleNames.AddRange(
					new string]
					{
						"PropertyEditor",
						"DetailCustomizations",
						// ... add private dependencies that you statically link with here ...
					});
			}

			DynamicallyLoadedModuleNames.AddRange(
				new string]
				{
					// ... add any modules that your module loads dynamically here ...
				});

            if (UEBuildConfiguration.bBuildEditor == true)
            {
                LinkThirdPartyStaticallyOnWindows = false;
            }

            if (Target.Platform == UnrealTargetPlatform.Win64)
			{
                string SDL2Path = ThirdPartyPath + "SDL2/SDL/";
                string SDL2LibPath = SDL2Path + "Lib/";

                PublicIncludePaths.Add(Path.Combine(SDL2Path, "include/"));
                PrivateIncludePaths.Add(Path.Combine(SDL2Path, "include/"));  // Public || Private !? is there documentation ?

                if (LinkThirdPartyStaticallyOnWindows) {
                    PublicAdditionalLibraries.Add(Path.Combine(SDL2LibPath, "SDL2-static.lib"));
                    PublicAdditionalLibraries.Add(Path.Combine(SDL2LibPath, "SDL2main.lib"));
                } else
                {
                    PublicAdditionalLibraries.Add(Path.Combine(SDL2LibPath, "SDL2.lib"));                    
                }

                PublicAdditionalLibraries.Add("Version.lib");
            }

            if (Target.Platform == UnrealTargetPlatform.Win32)
            {
                string SDL2Path = ThirdPartyPath + "SDL2/SDL/";
                string SDL2LibPath = SDL2Path + "Lib32/";

                PublicIncludePaths.Add(Path.Combine(SDL2Path, "include/"));

                if (LinkThirdPartyStaticallyOnWindows)
                {
                    PublicAdditionalLibraries.Add(Path.Combine(SDL2LibPath, "SDL2-static.lib"));
                    PublicAdditionalLibraries.Add(Path.Combine(SDL2LibPath, "SDL2main.lib"));
                }
                else
                {
                    PublicAdditionalLibraries.Add(Path.Combine(SDL2LibPath, "SDL2.lib"));
                }

                PublicAdditionalLibraries.Add("Version.lib");
            }
            else if (Target.Platform == UnrealTargetPlatform.Mac)
			{
				PublicFrameworks.Add("/Library/Frameworks/SDL2.framework");
			}
			else if (Target.Platform == UnrealTargetPlatform.Linux)
			{			
				//AddThirdPartyPrivateStaticDependencies(Target, "SDL2");
				AddEngineThirdPartyPrivateStaticDependencies(Target, new string]{"SDL2"});
			}

		}
	}

}



Notably, Target is now of type ReadOnlyTargetRules and AddEngineThirdPartyPrivateStaticDependencies now takes a ReadOnlyTargetRules and a string array.

Another thing is that the Mac and Linux platform builds are missing some includes, so you’ll have to edit the Build.cs further:



else if (Target.Platform == UnrealTargetPlatform.Mac)
			{
                string SDL2Path = ThirdPartyPath + "SDL2/SDL/";

                PublicIncludePaths.Add(Path.Combine(SDL2Path, "include/"));
                PrivateIncludePaths.Add(Path.Combine(SDL2Path, "include/"));

                PublicFrameworks.Add("/Library/Frameworks/SDL2.framework");
			}
			else if (Target.Platform == UnrealTargetPlatform.Linux)
			{
                string SDL2Path = ThirdPartyPath + "SDL2/SDL/";

                PublicIncludePaths.Add(Path.Combine(SDL2Path, "include/"));
                PrivateIncludePaths.Add(Path.Combine(SDL2Path, "include/"));

                //AddThirdPartyPrivateStaticDependencies(Target, new string]{"SDL2"});
                AddEngineThirdPartyPrivateStaticDependencies(Target, new string]{"SDL2"});
			}


Not sure if anyone is still following this thread -I personally find the official RawInput plugin to be unusable with all its issues and prefer to use this one.
I discovered that some of our players had issues with Thrustmaster T.A.R.G.E.T emulation software, which would join several devices into one virtual device, and for some devices create names with special characters that are used in Unreal’s Input.ini / GameUserSettings.ini file formats.
Therefore, I would recommend that, apart from dots, you also strip out any special chars used by this format, or just limit device / product names to A-Za-Z0-9 plus ’ ', - and _.