Hey everyone, my plan is a sitting character = disable my third person movement,and put different actions for 8 different thumbstick angles + facebuttons (= 8x4=32 input variants) onto it. so i want 8 (thumbstick directions) + neutral thumbstick position and each of them with a different action for a button.
is this possible with the input system? what is the best way? should i use thumbstick values or convert them into angle spans?
i hope you understand what im talking about
8 different thumbstick angles <ā¦> is this possible with the input system?
If you talking about Enhanced Input
, then you can create a custom UInputTrigger
with parameters like AngleFrom
& AngleTo
(or Angle
& Delta
), that will check passed 2D value and will either avail(ETriggerState::Triggered
) or forbid(ETriggerState::None
) the bound InputAction
from triggering.
So you create 8 InputAction
s, each with your trigger and custom parameters per action.
neutral thumbstick position
Use the DeadZone
modifier for InputAction
or the same modifier(or was it also a trigger?) in InputMapping
+ facebuttons
If you really need this⦠then there is a trigger called āChorded actionā, that check whether any other InputAction
is currently triggered, so that your InputAction
have to be triggered with a chord.
So you create a 4 InputAction
, one for each of facebuttons and use them as a part of chords in other ⦠32 actions.
I donāt know your goals, so I canāt recommend anything particular, but I suggest to doublecheck if you can reduce amount of actions by any way on design level, as managing 32 nearly identical InputActions doesnāt sounds like a good idea
thanks, this are some informations i didnt know that will bring me forward.
maybe there is a way, that i only create inputActions for the FaceButtons and they do different things in relation to thumbstick value.
there are a few radial UI widgets you could take a look at for reference on the marketplace as one idea.
as for switching based on the joystick angle, Iād use enum. So when joystick is in a certain range, you say the current joystick enum = A.
Then when a button is pressed, you get the current joystick enum and switch on whatever it is.
IMO Switch node is often forgotten.
Quick example how it could work using middle of screen and mouse position (on a squared viewport):
Too much math.
Put most of that into on-begin-play, save it as a ratio, use the ratio to perform on tick calculations.
Re the rest.
In input settings, you can set scale values for each input.
Instead of having thumbsitck x or y axis, just map buttons directly to thumbstic up/down/left/right, and scale values appropriately.
(If the goal is to simulate a keyboard the value is always full).
Forward 1
Back -1
Right 1
Left -1.
Doing it this way, the output for a corner is always 1,1 or 1,-1, or -1,1 or -1,-1
Everything else will always have a 0 to it.
The axis press however is a bit tempermental - badly calibrated devices can be an issue at times / wouldnāt do anything fancy like a Quantic style press sequence using this methodā¦
However, if the goal is to have the most similar gameplay between controller and keyboard, this is the best solutionā¦
You think? IMO itās simple enough and scales to any number of actions:
Btw cool to see you around the forums again.
Yes, but why do the same math every tick when the result of it wonāt change?
Essentially, youd never ask an on tick function to do1 + 1, youād just say +2.
Same thing here with pulling the screen size.
Trig is trig, so unless someone outclasses Pythagora I doubt we can do less math to find anglesā¦
Though perhaps dot instead of all the atan2 stuff can produce positive/negative ratio values similar to the option I gave above and cost slightly less.
In practice, unless you are powering a cpu with a potato atan2 is good enough/betterā¦
Ps: same idea on doing 360/8 as math instead of using a value btw,
Its good to show people how/what to do like you did because it is otherwise hard to follow/change, but Iād set those up as variables instead.
i bet like 30% of my code is switches, haha. but iām self taught recluse and never seen any real code so I just learn like 5 things that work and keep using them everywhere.