Gamepad-Friendly UMG ~ Control Cursor with Gamepad Analog Stick! Easily Click Buttons!

I hope you have right.
It will be a shame if implement this and cant use it in newer versions.

no idea how to resolve these errors but this is what i get when i try to manually rebuild for 4.26 from 4.25. this is a sample of the errors

Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol ā€œ__declspec(dllimport) class UClass * __cdecl Z_Construct_UClass_UDeveloperSettings(void)ā€ (_imp?Z_Construct_UClass_UDeveloperSettings@@YAPEAVUClass@@XZ) referenced in function ā€œvoid __cdecl `dynamic initializer for ā€˜public: static class UObject * (__cdecl*const * const Z_Construct_UClass_UGamepadCursorSettings_Statics::DependentSingletons)(void)ā€™ā€™(void)ā€ (??__E?DependentSingletons@Z_Construct_UClass_UGamepadCursorSettings_Statics@@2QBQ6APEAVUObject@@XZB@@YAXXZ) cpluspluginfix C:\Users\3950\Documents\cpluspluginfix\cpluspluginfix\Intermediate\ProjectFiles\Module.GamepadUMGPlugin.gen.cpp.obj 1
Error LNK2019 unresolved external symbol ā€œ__declspec(dllimport) public: __cdecl UDeveloperSettings::UDeveloperSettings(class FVTableHelper &)ā€ (_imp??0UDeveloperSettings@@QEAA@AEAVFVTableHelper@@@Z) referenced in function ā€œpublic: __cdecl UGamepadCursorSettings::UGamepadCursorSettings(class FVTableHelper &)ā€ (??0UGamepadCursorSettings@@QEAA@AEAVFVTableHelper@@@Z) cpluspluginfix C:\Users\3950\Documents\cpluspluginfix\cpluspluginfix\Intermediate\ProjectFiles\Module.GamepadUMGPlugin.gen.cpp.obj 1
C:\Users\3950\Documents\cpluspluginfix\cpluspluginfix\Plugins\GamepadUMGPlugin\Binaries\Win64\UE4Editor-GamepadUMGPlugin.dll 1
Error MSB3073 The command ā€œchcp 65001 >NUL && ā€œC:\Program Files\Epic Games\UE_4.26\Engine\Build\BatchFiles\Rebuild.batā€ cpluspluginfixEditor Win64 Development -Project=ā€œC:\Users\3950\Documents\cpluspluginfix\cpluspluginfix\cpluspluginfix.uprojectā€ -WaitMutex -FromMsBuildā€ exited with code -1. cpluspluginfix C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.MakeFile.Targets 54

are you willing to cook something up again for 4.26? appreciateā€™cha

4.26 port How to move the Mouse Cursor using the Gamepad ā€“ FPS Game Starter Kit

Have fun!

thanks appreciate & you!!

I ran into the same issue. For me it turned out to be an outdated version of Visual Studio. Try to update to the latest version, which is 16.8.2 right now, and the problem should go away.

Hey everyone,

Love this plugin, thanks !

My players and I are having an intermittent issue with cursor drift while using a controller. Is there a way to configure a deadzone?

4.27 port, have fun! How to move the Mouse Cursor using the Gamepad ā€“ FPS Game Starter Kit

2 Likes

Anyone able to figure out how to get the plugin to use the right thumbstick instead of the left?

Is there any way to configure the speed of the cursor? I would like to change it at runtime so players can change the sensitivity :slight_smile:

Pass in EAnalogStick::Right to GetAnalogValues() on GameAnalogCursor.cpp line 149 (as of the 4.26 version)

from:

const FVector2D AccelFromAnalogStick = GetAnalogCursorAccelerationValue(GetAnalogValues(), DPIScale);

to:

const FVector2D AccelFromAnalogStick = GetAnalogCursorAccelerationValue(GetAnalogValues(EAnalogStick::Right), DPIScale);

If anyone figures out how to change which button interacts with the widget Iā€™d love to know.

edit: Ok, I found it, itā€™s in FAnalogCursor::HandleKeyDownEvent which is apparently a class designed for a cursor to be controlled with an analog stickā€¦ which makes me question why any of this exists.

Hello!
It works great for me in Editor. But on a Nintendo Switch, everything is black, it doesnā€™t work.
Device Output Log writes such weird things!

Output Device Log

Help me!

Oddly enough, when I do this the left thumbstick becomes disabled as long as the virtual cursor is enabled. I need to find a way to have them both enabled.

I got this working today with the UMG plugin in UE5.0.2, I can move the mouse cursor with the right thumbstick and the left thumbstick is still usable!

Steps

  1. Navigate to where you have the UMG pIugin, I have it in my project directory so the path is:

project_directory > Plugins > GamepadUMGPlugin > Source > GamepadUMGPlugin > Private/Public`

  1. Override the HandleAnalogInputEvent from AnalogCursor.h

GameAnalogCursor.h

virtual bool HandleAnalogInputEvent(FSlateApplication& SlateApp, const FAnalogInputEvent& InAnalogInputEvent) override;
  1. Add two private functions as well
	FORCEINLINE FVector2D& GetAnalogStickValue(EAnalogStick Stick = EAnalogStick::Right)
	{
		return AnalogStickValues[static_cast<uint8>(Stick)];
	}

	/** Input from the gamepad */
	FVector2D AnalogStickValues[static_cast<uint8>(EAnalogStick::Max)];

These replace the private function calls in AnalogCursor.h that arenā€™t directly accessible. I changed the names of these slightly to avoid confusion with the parent versions.

  1. In the function implementation, comment out the code to do with the left thumbstick, this code is from AnalogCursor.cpp

GameAnalogCursor.cpp

bool FGameAnalogCursor::HandleAnalogInputEvent(FSlateApplication& SlateApp, const FAnalogInputEvent& InAnalogInputEvent)
{
	if (IsRelevantInput(InAnalogInputEvent))
	{
		FKey Key = InAnalogInputEvent.GetKey();
		float AnalogValue = InAnalogInputEvent.GetAnalogValue();

		//if (Key == EKeys::Gamepad_LeftX)
		//{
		//	FVector2D& Value = GetAnalogValue1(EAnalogStick::Left);
		//	Value.X = AnalogValue;
		//}
		//else if (Key == EKeys::Gamepad_LeftY)
		//{
		//	FVector2D& Value = GetAnalogValue1(EAnalogStick::Left);
		//	Value.Y = -AnalogValue;
		//}
		if (Key == EKeys::Gamepad_RightX)
		{
			FVector2D& Value = GetAnalogStickValue(EAnalogStick::Right);
			Value.X = AnalogValue;
		}
		else if (Key == EKeys::Gamepad_RightY)
		{
			FVector2D& Value = GetAnalogStickValue(EAnalogStick::Right);
			Value.Y = -AnalogValue;
		}
		else
		{
			return false;
		}
	}
	return true;
}
  1. Finally, call your new function in the Tick() at line 149:
//grab the cursor acceleration
const FVector2D AccelFromAnalogStick = GetAnalogCursorAccelerationValue(GetAnalogStickValue(), DPIScale);

If you donā€™t change this function call, the original parent function GetAnalogValues() will still be called and your thumbstick values wonā€™t be correct. Tripped me up for a while.

Hope this helps people out, happy thumbsticking!

4 Likes

Appreciate he above, but any chance the original will be updated to 5.0?

2 Likes

I am looking for a way to change gamepadā€™s left mouse click from Bottom Face Button to another button for console. For example on PS4 X==Click to O==Click.
Anyone has any ideas?

UE5 version posted on the website How to move the Mouse Cursor using the Gamepad ā€“ FPS Game Starter Kit

-Extract to YourProjectFolder/Plugins/GamepadUMGPlugin
-Add a new C++ class, doesnā€™t matter which one, but keep in mind that this step cannot be reversed, so make a backup first
-Compile as shipping build

Have fun!

2 Likes

Hey does anyone have the same issue like me? if i switch von keyboard to gamepad sometimes the visual cursor is moving automaticly

1 Like

I noticed a post from 8 years ago asking about the right analog stick having input blocked while this is enabled. Any idea if thereā€™s a way to fix that? I canā€™t imagine nobody is trying to use the right stick to scroll.

Is it normal for the plugin to be 3GB? @SB1985

I find my cursor teleports the center of the screen randomly. Has anyone got any ideas why this might be happening?