Transition from a walking blendspace to a crouching blendspace using a bool?

I’m trying to switch my character from a standing walk blendspace to a crouching walk blendspace when pressing and holding left shift. So far I’ve been unable to do so. I don’t understand how to set it up so that when I press left shift the character goes into crouch and stays there until it is lifted while being able to play the crouching walk animations in the meantime.

I’ve already tried several different ways to get this thing working including a bool with no luck. I don’t see anything regarding crouching in the examples.

if you have distinctive change, you can do it with in a state machine, or blend animation with a blend node in animation graph.
You would have to set a bool variable inside event graph, and use it in anim graph to make it turn to a float and use it for blend node.

Here are the screenshots of the graphs, I had set that crouching bool and it sort of works. Anim graph 1 and 2 shows that the character does go between distinct states and when I run either state and not both they run great independent of each other, however when together they just don’t work at all.

They are practically the same blendspace and share “speed” and “direction”. The problem seems to be that when I actually play the level, the character only blends between the walk and crouch instead of transitioning when the crouch button is hit.

Sounds to me that this could be more of an event graph problem seeing as the state machines seem to run fine within the preview, it’s a matter of being applied.
Thanks again Penguin, I look forward to your response.



if by transition you mean to see it slowly change from walk to crouch, you need to increase the true/false blend time, you have it on 0.1, so it roughly uses 3 frames to blend if your animation is in 30fps.

Close, I mean I can’t seem to get the full crouch state to play at all. It’s obvious to me that it tries to put the character into that state, and the animations seem to blend a little bit. However if I press shift it simply will not completely change the state from “walking” to “crouching”, only walking with oddly blended partial animations. The character doesn’t actually crouch or lower at all, only his legs and arms will move differently.

It seems as if the general settings are correct but there’s a hitch somewhere. Does my event graph appear to be legitimately set up?

LOL. okay I got what you are saying after check your event graph.
Yes, you have it wrong.
You are not suppose to set the state variable base on the result of something that was calculated on the fly.
you have to see it like this, an animation blueprint can be created and assigned to many different Pawn, so even though it looks like each pawn has its own copy, you still need to treat those state variable as independent thing.
this is also why you need to call “TryGetPawnOwner” inside event graph of a animation blueprint, instead of just pulling variables from pawn directly.

So what I did in my setup would be:

  1. in your pawn blueprint, have a variable say bCrouching, so “Input Crouch”(bind to shift or whatever) press/release set it to true or false.
  2. in your animation blueprint, after get pawn owner, you can get that “bCrouching” and set your “isCrouching?” in event graph.(like right at the beginning of white execution line)
    In case if you have to use CastTo for your Pawn, I suggest that you create a interface function to get it, for long term scalability.

Changed the bool for the pawn as “bCrouching” and changed the anim BP event graph accordingly and I did notice a difference in that it now followed the pose blend time that I had changed after you pointed it out.
So the graphs are cleaned up, however the issue still remains with the crouch animations not being played…

Maybe there’s some clean to do with my blendspaces, so here are the pics.


I appreciate the help… and the patience :slight_smile:

can you show what’s in the two states machine node you have?
your blendspace seems to setup proper to blend into different direction of movement.
So I assume that your state machine is what failed to use proper animation.

Figured it would save space this way. The headers should tell you what’s what.

so the lower left probably is what causing it?
Because you have 2 state machine does exactly this, but you also want to blend animation.

I did a tiny experiement with crouch set to jump animation in third person template, and with easy success for my blend.
And my crouching state have only one state, where as my regular idle/walk keeps the original state machine.
I also found a potential problem if your gladiator is in air falling, and then you engaged crouching state, it will be forced to use crouching animation anyway.

To not make all your effort in vain, keep your current state machine in movement.
And get rid of blend and crouching state machine in anim graph, just use the walking state machine.
Then in the walking state machine, click on the rule you have, set the blend time would be good enough.

Okay so the transitions have been cleaned up. The legs pull more towards how they do when he is supposed to be crouching, however the upper body has practically no change at all, his hips to his head do not drop at all.
Do I need to do some sort of special blend composition to get this to work? It seems as if everything is set up correctly now, but the animation just doesn’t want to kick in. I disabled jump just to make sure it wasn’t interfering but maybe that won’t do any good. I hadn’t set up IsInAir? or anything like that yet because I wasn’t planning on making him jump yet. Can that be the problem?

— Oh and what is this thing I see “Blend weight”, could that have anything to contribute?

------ Also the more I tweak the more it becomes apparent to me that the hips do not drop… Is that an issue with the root bone, maybe I didn’t actually animate my rig correctly for these crouching anims. I’ll check that out next, it’s great to have the easy re-import tool. ---- Scratch that I just remembered I tested the crouch state by itself and it was fine.

just remember that the bones affect in later partial animation blended in like Thrust/RightSlash you have in the beginning of post could also effect the result of your overall animation.
Test without those and make sure all your base movements are fine before hooking up more animation changes. :slight_smile:

Tried that, it wasn’t an issue. I’m going rebuild my level into the new 4.41 see if that makes any difference.
I’ve heard that sometimes things are just temporarily broken inside the editor and that doing a rebuild can fix a few issues.

It wasn’t the editor, something is just very wrong somewhere and I don’t know what to do. Is this a possible issue because I’m using blender?

I guess I’m going to have to wait for someone to make an actual “crouching” tutorial.

if you want you can zip the project(remember to clean up so it’s smaller), I can take a look.
replace with default asset would be best(if skeleton is the same then it’s doable), this seems to be simple enough for setting up, I don’t know why it’s causing you problem.
pm me if you don’t want others to download your asset.

Okay so I created a work around. I made a new 2d blendspace for both crouch and walk together… when I press crouch and it decreases the speed, the crouch animations play based on the reduced speed of the character. However this does make some very odd transitions if the player is at a standing idle, which I would prefer though I guess he could idle crouched. He briefly shows the crouch before entering a walk, can I control this inside the blendspace? From what I can tell I won’t be able to do much when it’s hooked up in the anim graph as a single piece.

Hope you don’t take offense, but I would rather figure it out and battle through it with help, I appreciate the offer but I can’t truly learn this engine if anyone solves my problem for me. I do however hope that you will continue to offer your support and sound advice as I continue my attempt to conquer this small hurdle.

I’m also trying to set up in the movement state a go between for standing walking and crouched walking where the crouched idle is triggered by the crouch button, after that any speed would cause it to go into the crouched walking state. The character will continue to be in the crouch idle state until the crouch key is struck again.

Using the bool system you supplied this does work in the preview, however within the game there is still the issue that the gladiator doesn’t enter the crouched idle state. And I believe that this is a conflict between both the standing idle and the crouching idle both having the speed of 0 and fighting for it. Standing is higher on the pecking order and so it is given priority at all times. Is there a way I can ignore current speed and have the attention based on whether or not that button is pressed?

Thanks again for all the help, it hasn’t been in vain, I am learning regardless! :slight_smile:

I like your statement, no offense taken.

Like you said to drive crouch with speed is not a good way, you figured that as well.
I do hope there are some video reference so it’s better to see what’s happening when you do things.

from what you have offered, a boolean should be able to toggle between states for sure, but your current state machine have a problem that:
crouching moving would have to become crouch idle, then stand up, then walk.

So actually your original state machine on post #9 is better to handle this situation, you did right but just have that extra state machine from my perspective.

The logic is simple:
both crouchMoving and walking are taking direction and speed, the only difference is one have crouch set to true and with reduced speed range for interpolation.
so whenever you toggle between these 2 state with key press/release, it will blend to another state and still playing the animation.
Now, you do NOT need a standing idle to crouching idle animation. Just standing idle loop, and crouching idle loop, blending will do the crouching for you.

If you have specific stand up/crouching down animation, you’d have to refer to what the stock animation blueprint did for jumping.
But let’s just not going that far yet and focus on getting the simple things right first.

If you check the marketplace a animation setup was released by epic with the basic hero character. It includes crouch!

However from my first couple tries I was unable to successfully pick it apart to get it to work on my character, as always my character refuses to transition from standing to crouching within the actual game play, even when it shows full functionality in the anim graph preview.

Would you might checking out their setup and trying to relate it to me, I’ll post some more of my progress soon.

After checking it and crash my work computer(I don’t know why but it crash from time to time, maybe because of Quadro?), lol, I say Epic released a half-■■■■■ ASP_Character.
You can crouch walk press jump, and when you release crouch after a half mile, your character actually do the jump. Epic logic fail, pun intended.
Maybe it’s just something whipped up quickly so people can do whatever they want, but I feel kinda sad it doesn’t include properly setup notify events and such.
(only a few animation has notify event tied to them, like the 2 jumps)

Complaint aside, it is a good way to see how you can approach it, with state machine and pawn blueprint variable. So definitely check it out.
It also has all those other animation I can go through a full hook up that I mentioned in another thread.
The state machine is setup that way because they have a idle jump and a run jump, where I believe 99% of time people are not gonna see idle jump.

It doesn’t provide any new information really, so let me know which part you’d like to explain more in detail.
Too bad they didn’t include prone movement animation, which is weird as they do have prone_fire_xx.
(no prone_moveFwd/Back, nor fromStandtoProne)