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

Option to set Axis range #170

Open
nitroSkirata opened this issue May 13, 2020 · 9 comments
Open

Option to set Axis range #170

nitroSkirata opened this issue May 13, 2020 · 9 comments

Comments

@nitroSkirata
Copy link

Hey,
It would be really nice to have an option to set the range of and output axis.

What i mean:
currently the axis go only from -50 to +50, for a total range of 100.
Id like to be al=ble to change this to be from 0 to 100 for a total range of 100.

this is important for me, since i want one axis to have a higher sensitivity, always being 120% above the original axis and not 80% below the original axis, for the first half of the travel.

@evilC
Copy link
Collaborator

evilC commented May 13, 2020

This is incorrect. Internally, axis values are actually -32768...32767
Various GuiControls (Deadzone, Sensitivity etc) use differing scales -
Deadzone uses 0..100 (%)
Controls such as the "Press Value" for ButtonToAxis use a scale of -100..+100 (%)
Sensitivity uses an infinite scale: -200% or +100% or +100000% are all valid values
Nothing uses -50...+50 as far as I am aware

If you want one axis to be 180% as sensitive as another, use a Sensitivity value of 180%
This would result in a curve, if you do not want a curve and are OK with not all of the input axis mapping to a discrete output value, then check the Linear option

@evilC evilC closed this as completed May 13, 2020
@nitroSkirata
Copy link
Author

Okay,
maybe i explained my problem wrong:

I am flying a 4 engined aircraft in a flightsim and use UCR to duplicate my throlle axis, to have one for each engine.
each engine throttles from 0 to 100%, but engine 3 needs a tad more throttle then the others.

therefore i'd like the throttle to always add to the input axis, and not subtract for the first half of the travel.

Since i had no idea what the actual values were, i just use the arbitrary 0 to 100 scale in my first post.
Untitled1
Untitled2

@evilC
Copy link
Collaborator

evilC commented May 13, 2020

Ohh, I see what you are saying
OK, we wouldn't need to change the scale, we would just need a new sensitivity option that treated the bottom left as the origin rather than the middle

@evilC evilC reopened this May 13, 2020
@evilC
Copy link
Collaborator

evilC commented May 13, 2020

Try this
AxisToAxisUnsignedSensitivity.zip
(Right click the Zip, properties, check unblock, then extract and place in the UCR.Plugins folder next to the existing UCR.Plugins.dll)
Adds a new plugin "Axis To Axis (Unsigned Sensitivity)"

@nitroSkirata
Copy link
Author

Hey, that was a quick answer , thanks :D

though i think i miss something, as i can't set the sensitivity.
Annotation 2020-05-13 213853

@evilC
Copy link
Collaborator

evilC commented May 13, 2020

D'oh, dunno what happened there
AxisToAxisUnsignedSensitivity.zip

@nitroSkirata
Copy link
Author

Thanks, just trying it out, and it works like a charm :D

the only further suggestion i'd have is to add a invert sensitivity option (change from wich end of the axis the sensitivity is applied)

for me currently the sensitivity seems to be applied from the high end (when is input is at maximum, the output equals the input).
Untitled1

@evilC
Copy link
Collaborator

evilC commented May 14, 2020

I had a quick stab at it, but cannot seem to wrap my head around the maths

The existing code does this (value is a signed 16-bit integer -32768...32767)

  1. Add 32768 to value (Shifts scale to 0...65535)
  2. Multiply value by sensitivityFactor (eg for 150%, multiply by 1.5)
  3. Subtract 32768 from value
  4. Cap value to between -32768 and 32767

so eg for a mid-point value of 0:

  1. 0 + 32768 = 32768
  2. 32768 * 1.5 = 49152
  3. 49152 - 32768 = 16384
  4. Cap to -32768...32767 = leaves at 16384

for a min value of -32768

  1. -32768 + 32768 = 0
  2. 0 * 1.5 = 0
  3. 0 - 32768 = -32768
  4. Cap does nothing

for a max value of 32767:

  1. 32767 + 32768 = 65535
  2. 65535 * 1.5 = 98302.5
  3. 98302.5 - 32768 = 65534.5
  4. Cap to -32768...32767 = 32767

Can you work out the maths for what you want?

@nitroSkirata
Copy link
Author

tbh, i have no idea how the maths work, but i can explain how i went around it:

1.In UCR I enable the invert setting
2. i added the sensitivity multiplier (104%)
3. i inverted the axis in the game

I hope this helps you

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

2 participants