I am trying to find a efficient way to detect that the player is making a quick move input, and move input inversion and am having some issues.
-The use of this would be, for example, the player is suddenly changing direction, which would play a specific animation for that.
-Another example would be, the player going from walk to run, and then stop pushing the stick completely so it should suddenly stop and play a specific anim and not go down to walk and then stop.
The issue is that by detecting frame delta i do not know the ‘‘intent’’ of this action.
In the first example, it dosent know if the player has moved the stick in a different direction, it simply know its going down, and for the second example, leaving the stick down, can be interpreted as slowing down to walk instead of stopping completely.
Anyone designed any system similar to this to capture move input direction or value and filter them out really fast to pass on to the animbp ?
I was thinking gates could do it, but are they efficient enough as i would need multiple to detect it. ?
You can use these methods to get the velocity and the difference between your character’s movement direction and rotation vectors. You can use the direction and velocity to blend animations in a BlendSpace and play it in your Animation Graph.
Hi, thank you for the answer,
I already use these to store my speed and direction for my blendspaces, what i am looking for is how to detect quick change in input of the joystick itself, like flicking your stick from the top to the bottom to suddenly run the other way.
At that moment i want to use that so i can play a different blend animation and change the acceleration values for a little while.
I dont want false positive caused by simply moving the stick top to bottom sloly, which is why the speed of input is important, not the speed of the character
If you assign the Joystick to an axis event in the project settings > input, as MoveForward == joystick up/down, MoveRight == joystick right/left, then you can retrieve the axis value of this event when required even outside of the axis event. (like by timer)
The input axis “SpeedOfInput” value is a range between -1 and 1. So now we can easily compare moments in time A to B, how much the axis has changed in between them if we store the axis value at moment A.
Just to make an example let’s use the event tick (every 1 sec) as an example to compare the SpeedOfInput on the Y axis event to a previously stored state. After testing you should probably use a timer instead to control the responsiveness, instead of butchering the event tick.
The Boolean MoveForwardFlipped on the image could be one of your conditions used in an animation state machine to make your character switch to a state playing its own unique animation. You could do a comparison, like if ((AbsoluteDifference > 0.7) and (SpeedOfInput == 0)) then the character stopped quickly. You should pull this info inside your AnimationBlueprint.
For info the function FGetAbsoluteDifference as seen on the image is in a library of mine and written like this:
thank you for taking the time to make detailed breakdown its much appreciated.
Unfortunately i tried something like you are showing before and comparing only 2 frame isnt reliable enough as you have plenty of time to change your mind or not enough time to have the input detected.
One difference, Instead of comparing move forward i was comparing input direction since i want it to work in multiple direction.
I mentioned in the initial post that i was trying to make it work using a gate, giving the user a short moment, and during that moment compare the input.
I managed to get it to work, i attached a screenshot.
I kind of hate using gates, they cant be in functions and i need three time a similar graph, to check for input release, input inversion and quick input to do a running start.
If there is no alternative i guess ill have to go with this.
I am aware of the axis input, but i have to detect not only up down movement, it could be of any direction on the stick, diagonal left down to diagonal right up for example mean the same thing as up down. Would that be possible with separated input mapping ? Maybe check only when at least one is over 0 to reduce tick dependency ?
suda145, you mention using timer instead of gate, but i need to check during a moment, not only at the end. For example, you move Right, then inside of 0.25 sec your input is -1, then play the quick change direction animation, if at the end of 0.25 it reached zero, play the quick stop moving.
Is it possible to do that with timer ? I considered timeline but am not sure its worth it.
It would definitely be easier with 2 mappings. One for X/Y (Forward/Backward, Right/Left) and the other for Pitch/Yaw… same as KBM setup.
Most games that I’ve played that have swimming/diving have dedicated inputs for ascend/descend. The mouse axis, while swimming, only accept/process yaw and limited pitch. So I can’t use my mouse to look down and then press forward to dive. Only while underwater do I get full range pitch/yaw.