jaydenmaalouf / joystickplugin Goto Github PK
View Code? Open in Web Editor NEWNative Input Joystick Plugin for Unreal Engine 4/5
License: MIT License
Native Input Joystick Plugin for Unreal Engine 4/5
License: MIT License
A while after connecting the controller Axis 5 or 4 (which are R2 and L2 on my controller) keep firing for no reason. disconnecting and connecting the controller back fixes it temporarily but after a while it starts getting triggered again. This also happens if I just press any of these 2 axis and when I let go, its still getting triggered every frame
I was attempting to upgrade my project to UE5.3, and I noticed several linker errors.
This happens on the JoystickLogManager and it is because the template functions there are implemented in CPP and not in the header file. By moving them all there, the errors disappear
The subclasses of ForcedFeedbackEffect need some check to validate the modified update won't throw errors within the SDL object
Need to look into a way to validate on an individual class basis
I'm not sure if it's something you're interested in supporting, but I've implemented some very basic gyro/accelerometer functionality.
If you're interested in pulling that into the main plugin, you can find it here: https://github.com/Caffiendish/JoystickPlugin/tree/Gamepad-MotionSensor
It needs a newer version of the SDL library than the one in releases, though.
Hi, @JaydenMaalouf!
Thanks for your plugin, it helps us immensely!
I'm creating this new issue as a follow-up of #48.
I've looked into #56 and unfortunately, it doesn't look like the same problem I'm having.
In my case all buttons and axis are working as intended with the Enhanced Input System, even with runtime remapings, but if I enable the Enhanced Input User Settings in order to save the runtime remappings, when I restart the game, only the keys from standard gamepads and keyboard and mouse are loaded back. Any remappings from joysticks detected using the Joystick Plugin are lost.
You can see a video about this feature here: https://www.youtube.com/watch?v=u9vJ3FBaasU
Any help will be much appreciated!
it'll sometimes triple in the ui or non performance intensive scenes, so I think it's framerate based.
After a bit more testing, I think it happens when the game updates faster than the plugin, so it adds the same value twice or 3 times since the plugin hasn't had time to update. when the game's at a lower fps it works fine.
On 3.2.0-rc.10, the FJoystickInputDevice
class is missing the JOYSTICKPLUGIN_API
macro.
On my code I got a pointer to it through JoystickSubsystem->GetInputDevice()
but when I called JoystickInputDevice->GetInstanceIdByKey(Key)
I got the link error: Error LNK2019 : unresolved external symbol "public: struct FJoystickInstanceId __cdecl FJoystickInputDevice::GetInstanceIdByKey(struct FKey const &)const " (?GetInstanceIdByKey@FJoystickInputDevice@@QEBA?AUFJoystickInstanceId@@AEBUFKey@@@Z) referenced in function "private: bool __cdecl UCPKeyMappingSubsystem::GetKeyOwnerJoystickGuid(struct FKey const &,struct FGuid &)const " (?GetKeyOwnerJoystickGuid@UCPKeyMappingSubsystem@@AEBA_NAEBUFKey@@AEAUFGuid@@@Z)
After a lot of time banging my head on the wall, I found that this class was never exported on the plugin module.
Good day! I am developing a racing game and looking for a plug-in to implement car driving. Please tell me, your plugin makes it possible to connect several devices to the game at the same time (steering wheel, pedals, gearbox, button box, handbrake, each device is connected to a PC simultaneously via USB). Is it possible to read the readings of axes and buttons at the same time, for example, steering wheel axis 1 (device 1) - steering wheel rotation axis, pedal axis 1 (device 2) - throttle axis, pedal axis 2 (device 2) - brake axis, button 10 of the button box (device 3) - view change, etc.? I am also interested in the question: will your plugin be able to support DIY gaming devices (for example, arduino button box, stm32 steering wheel, etc.)? And also (if possible) tell me if it is possible to communicate with you by email, and not here? If possible, please let us know your email.
axis mapping is abandoned in UE5.2๏ผ does this plugin support enhanced input?
This obviously isn't supported by all joystick types but for those that do, integrate this with the existing implementation and allow it to be fed data from ForceFeedbackComponent (the UE built one).
To make the base classes more specific to their data structures, we should make the base effect templated and let the compiler handle the heavy lifting.
As part of this, we should create data structures specific to each effect type. Potentially create a base struct if there is a lot of overlap.
Hey again @JaydenMaalouf,
Another bug came up today, this one leading to crash on startup. It's fairly easy to reproduce.
JoystickCount
connected to the BeginPlay
This should lead to a crash. At least it does for me and a colleague. I've tracked down the issue to the fact is the JoystickDeviceManager
doesn't yet exist at the time of the JoystickCount
call. The manager actually takes a couple of seconds to spawn.
It's not an issue in-editor, or if your game/app doesn't use SDL right after launch. But it can become an issue in certain use cases (e.g. your default controller registers for SDL events).
However, I don't really know how to fix this. The manager is created by CreateInputDevice
, which is inherited from IInputDeviceModule
; so it's not like we can just call that earlier. I've tried changing the plugin's LoadingPhase
, but it doesn't seem to impact this call. I don't really have any idea of the call chain leading up to CreateInputDevice
being called, so I don't know why it occurs so late in the startup process.
For now the workaround is just to delay all calls to the plugin by a few seconds, which works, but isn't really robust (or nice). IJoystickPlugin::IsAvailable()
could maybe check if the manager exists, but even though that would prevent crashes, it wouldn't solve everything as call made before availability would just get ignored, without the user even knowing it.
I can investigate this more, but I wanted to get it past you first.
Bertrand
Need to demonstrate how to
Compile the plugin from source
Utilise Forced Feedback
Extend Effects
Need to declare the delegates using the UE Macros instead of using the weak UObject ref collection
Basically as the title says, need to add includes to the PCH
SDL2 does support Linux however, I haven't attempted to compile it yet.
Raising this so I don't forget
I kinda just kept going with the naming and now it's annoying me so I wanna change it lol
This will break everything using our existing classes
Hey @JaydenMaalouf,
We recently discovered that joysticks (as defined in the plugin) don't properly work with the InputKeySelector widget.
This widget is mostly used to allow runtime rebinding, which is extremely useful for joysticks, as there's really no standard way to define axes (e.g. each vendor will give a different index to the "throttle" axis).
The behavior between joysticks and the widget is weird: if the plugin isn't enabled, the widget totally ignores the joystick, which is expected. If the plugin is enabled, the widget apparently can detect part of the joystick, since the widget will correctly toggle if you move an axis, but the related event (On Key Selected
) doesn't fire.
I can't test this right now as I don't have a joystick, but I've been remotely debugging that with a colleague this morning. We currently have a workaround, so it's not a big issue. But it would be nice to have the ability to rebind joystick axes at runtime.
I could try to implement this myself, but seeing as you seem more at ease around this code than me, I prefer to open an issue first ;-)
As per sswires suggestion on the Slackers Discord - we should utilise the FInputDeviceScope struct to help the engine identify the type of controller being used.
Hi! I wanted to write about an issue that I'm currently facing with the plugin (at least with the sensor-implementation branch which supports UE5) where my DualSense controller appears under a generic joystick name titled "Joystick" (at least under Linux, I do not have a Windows install currently to test this on), and there's seemingly a double input related issue where the original controller device is not being hidden from Unreal. From what I've seen from other things using SDL2, they seemingly detect my controller type fine, which makes the issue a bit more strange.
Interestingly, even when I don't use the plugin, at least on Linux, my DualSense controller seems to behave similarly to an XInput controller, with a Platform and User Device ID of 0, so I don't know if there's anything inherently wrong with how Unreal handles input on Linux now, but I can at least confirm that I was able to recreate the issue using a Ubuntu Live USB to make sure that my Fedora KDE setup wasn't just weird:
I also wonder if there's any C++ or Blueprints related functionality for the plugin that allows you to grab the current controller type, such as in the case where you may want to run a check that changes controller prompt UI elements from say Xbox to PlayStation equivalents.
Need to compile the plugin for 5.1 and deprecate previous version
Greetings,
I'm attempting to use a TFlightHotasX with the plugin. While the plugin recognizes it in the Mapping Context as a "Joystick 0" for any button/axis, I would like to have the specific name of the device as I might have other joysticks connected to my project so I can easily distinguish between them.
I noticed in your Wiki on the Usage page that you indeed have different names showing up instead of just "Joystick 0" but I'm a bit confused on how this should be done.
These are my current project settings for the plugin:
Unlike in the Usage page, I do not have the option to select the key value.
Thank you
Previous author didn't implement any reference cleanups on destroy which means we have memory we haven't cleared up.
This isn't an issue with our UObjects as UE will GC for us but our SDL implementations have no cleanup right now.
To properly support CreateEffect, we should create a custom K2 node that handles auto casting.
This is more of a nice to have for anyone that wants true plug n play
When disconnecting a steering wheel and plugging it back in instead of it binding to "joystick0" It will keep "joystick0" but also add "joystick1" and it will only send axis and button events to the newly created joystick1, and again if i plug out and back in again it will make a "joystick2" and do the same thing again.
I develop for Oculus Quest, gamepad support was removed with the OpenXR API and the old API was deprecated.
Due to hardware limitations, there is a considerable loss of performance in UE5, preventing project migration at the current time.
Thanks
SDL2 Android compiled libraries could be found here:
https://github.com/AlexanderAgd/SDL2-Android/releases/tag/v0.1
Look into how we can use the plugin on marketplace versions of Unreal as apparently these don't come with SDL for Windows
If I disconnect the device I configured, the Events do not appear on Editor Restart.
With Connected Device and Configuration set:
But if I disconnect the device, this happens:
With warning being:
"InputAxisKey Event specifies invalid FKey'Joystick_TFlightHotasX_0_Axis0' for Joystick_TFlightHotasX_0_Axis0"
And if I search any input Event, they do not come up
It seems the events depend on whether there's a configuration AND if the device is connected, but we don't want to be dependant on the device being connected or not. Plus, we have an array of Joysticks to use and configure and we can't have all of them connected at the same time.
I tried to replicate with two joysticks at the same time and the same happens: while both configured and connected, they work, but if I disconnect one of them, its events disappear
Need to add the necessary license to the plugin files
Need to utilise the GitHub actions CI/CD to create releases when merged to master
This is a macro used in plugins for UE.
Need to reintroduce it.
When trying to rebuild the project after adding the plugin it fails to do so.
The project was already made in 5.3.1.
I also tried the fix mentioned in this issue Linker Error when upgrading to 5.3 but that didnt work either
Hello! Thank You for your work on this! :-)
I am spreading the word, Twitter and Discords.
https://twitter.com/Thunder_Owl/status/1427195438050971650?s=20
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.