Hello, I’m leveraging the 3rd person starter kit that comes with UE5.1. I’ve altered the ABP for Manny to include a new set of animation states for crouching and crouch walking. The changes can be observed in the images below:
The animation runs smoothly and without any issues. When I hold left ctrl the character crouches and as I move adding velocity the character increases in speed. When I let go of ctrl the character will either walk/run depending on my velocity or stand idle. My issue however, is that I can only transition into a jump while being in an idle, walking, or running state. When I am crouched I cannot jump. I’ve been trying to follow why this happens but can’t seem to find an explanation or fix for it.
There doesn’t seem to be a state for jumping in the ABP, so I am not sure how the character is even jumping. From my understanding some velocity is applied somewhere and whenever that vertical velocity exceed a certain threshold (or falls below) the character enters a falling state and this triggers those animations. But I can’t figure out why it is the case that when I am crouched, I cannot apply that same vertical velocity as I can when I am idle or walking.
Try searching references for “IsFalling”!
I believe you can right click the little plug on the “Set” node, but if not, use the magnifying glass down low! One way or another, that’s going to lead you where you want to go! If you’re confused from there let me know!
This seems to be when the Jump animation is triggered. If I am reading it correctly it checks to see that the vertical velocity is larger than 100 and isFalling is true, then it can enter the jump anim state. But I can’t see why this would not be the case while crouching as well?
Here is a screenshot of Main States. The graph logic here confuses me slightly, not sure why jumping is handled differently from walking/running. My guess is Epic wanted to encapsulate jumping and falling under one behavior/animation state.
OK so this is a typical problem with using state machines as it requires an entry and exit argument into and out of the current state. To get the state to change to the jump you would need and entry argument that change the migration path from the crouch and into the jump state which will work but will continue to compound the problems as to changing the animations based on the state change that has already occurred. Not ideal as the animation state changes would have to wait creating a blatancy issue as to the need to have the state change occur “on demand” no matter what the current state change is. State machines are very good when the animation sequences needs to occur in order such as a jump but does not scale very well.
What does work better is the use of components as they can be add directly to the controller or even the newer game play function plugin or as an option to the use of a state machine is to make use of a switching tree which can accommodate scaling with out the need for entry and exit arguments.
Based on a design logic I did this explanation a while ago
The tree approach works more or less based on the same scripting as a state machine but does not require and entry or exit argument as the controller has already determined what the current state is before it’s needed so will scale as to the correct path to take as well will enter and exit “on demand” with out have to expand the pathway logic of jthe use of a single state machine
I’m confused as to why I don’t need an entry argument when I’m walking/running but I would need one while crouching? It works fine when I am jumping while running, but not while I’m crouched, despite the implementation for both being identical. I can even go from a falling state (jumping) immediately into a crouching state without issue, just not the opposite.
Hey @Iby117! So after some sleep and coming back to this, I reread the original post and noticed a detail I must have gleaned over before… That the issue isn’t that you’re not playing the jump animation, though that is what you think it is. The issue is that you aren’t JUMPING. The issue is going to be in the player code where you added crouch, or around the jump functionality in the third person character!
Sorry for the misunderstanding! But this isn’t an animation issue!
Thank you! I think you’re right, I’m looking over the blueprint now to see if I can identify the issue. I’ve gone ahead and changed the category that the question is in and rephrased the question. I appreciate your time and efforts .
For anyone who can help, here is a screenshot of the blueprint where I added the crouching code.
My guess is that since crouching action node has a triggered and completed pin, nothing is allowed to happen until the completed action occurs. In other words, I cannot jump until after I have uncrouched. Not sure how I can make the change in the blueprint to accommodate that.
OKAY! So! The crouch built into the Character Movement component does not support jumping while crouched, you would have to program your own version. HOWEVER we can do a workaround!
First, make a bool called “IsCrouching?”
Next, add a set “IsCrouching?” → true and → false BEFORE the “Crouch” and “UnCrouch”, respectively, on the Crouch input.
Now we’ll add a branch on the “Jump” input. Before “Jump”, add a Branch and for the input use the “IsCrouching?” bool. Off of false, run as normal. Off of true, add another “UnCrouch” node. So off of true, you’ll “UnCrouch” → Jump.
Then lastly, on the “Complete” of jumping, AFTER the “StopJumping” node, you’ll do another branch and check “Is Crouching”. If “IsCrouching” = true, “Crouch” node. If “IsCrouching” = false, do nothing
@Mind-Brain great approach, I implemented what you said, however, now I believe it is an animation issue. The camera moves up as if the character is jumping but the character remains crouched. I’m believe it may be the fact that holding crouch will continuously trigger the crouching animation. It would seem the uncrouch in the jumping code is not doing its job
Well after searching for a while and only finding conversational solutions seemingly made from a mobile phone, I present to you what the people are looking for… A blueprint image of a complete and tested solution.