To begin with, I have set up a blend space to control transitions between differen animations: idle; jog and sprint using a variable (BSSpeed).
In the animation blueprint, find the "State Machines". This is where all the magic happens. I have created a loop, starting from Locomotion to "Hit the Ground"; "FiringRifleLoop"; "BackOnYourFeet" then finally go back to Locomotion. Each state represents an animation sequence, and each transition icon stands for the conditions that required to move on to the next state.
These are the conditions, reading from left to right, from top to bottom.
The float variable (BSSpeed) comes from the vector length of character pawn's velocity. The boolean variable (Firing) comes from the boolean (Is Firing) in the Character blueprint.
In the Character blueprint, the "EnhancedInputAction IA_Fire", which triggers when the F key is pressed or released, will affect the boolean variable "is firing". When implementing this variable into movement mechanic, I am able to stop the movement input when Is Firing equals True. I added another boolean "Is recovering" to make sure that when "Is recovering" equals True, the movement input is delayed by 1.5 seconds.
Finally, I create a custom GameMode for my character so that I don't need to set it up everytime.
I have recreated the process on the Mutant character, and instead of old animation states, I made him roar at the end of the fighting action.
I made some changes in the character BP to make this anim cycle a bit more smooth. This logic divides time into repeating segments of 80/30 (AnimFrame / FramesPerSecond). If the current Triggered-Seconds is less than the threshold, it delays by the remaining time until the threshold. If it’s greater than the threshold, it multiplies the threshold by the segment count, then calculates and delays by the difference between that value and the current Triggered-Seconds.
Perforce Prof & Position: