Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InputAxis double counts joystick axes state #11

Open
Mattk50 opened this issue Aug 27, 2019 · 3 comments
Open

InputAxis double counts joystick axes state #11

Mattk50 opened this issue Aug 27, 2019 · 3 comments

Comments

@Mattk50
Copy link

Mattk50 commented Aug 27, 2019

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 ue4's binding system 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 when slightly wiggling a stick in place: (Pitch left, yaw on right)

frame 1: 0.128208 | 0.999939
frame 2: 0.25544 | 0.991211
frame 3: 0.126621 | 0.979247
frame 4: 0.251411 | 1.926389
frame 5: 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 sometimes.

@verraneventide
Copy link

verraneventide commented Sep 9, 2020

I noticed this, too. After much frustration, I learned that the engine call to EmitAnalogInputEventForKey() applies acceleration via the engine (UE4) itself (!!!!!), which causes the frame jumps. Shout out to https://www.twitch.tv/jitspoe for helping me troubleshoot and navigate this finding.

I got around this by modifying the plugin source code to write the raw values to TMaps, and reading from them during gameplay to get the real/raw non-accelerated device value(s).

Totally blame Epic for this one. It sure would have been handy to have a parameter in EmitAnalogInputEventForKey() to disable the acceleration accumulation.

@Mattk50
Copy link
Author

Mattk50 commented Jul 22, 2021

The solution i found was to modify the plugin so it doesn't constantly add the same input multiple times per frame because it's running on a different thread. Basically an array of bools lock the input every tick and gets reset every new tick, quick and dirty but works fine.

The issue definitely isn't acceleration on ue4's end, it's that the plugin is basically adding the same joystick input to the same receiver more than once before it gets used. You can verify that it's not an acceleration problem yourself by observing that the extra values are always integer multiples of the expected value.

@JaydenMaalouf
Copy link

Hey @Mattk50,
This is actually an issue with the way the plugin registers the input.

I have fully reworked the plugin and resolved this issue in my implementation.

See here: https://github.com/JaydenMaalouf/JoystickPlugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants