Why can't my character jump (sometimes) after peforming an attack combo?

Hello! I’m encountering a bug with the blueprint editor. For some reason, my character won’t jump, after performing a punch attack (which I created). I’m attaching an image of my Combat blueprint, since I’m fairly certain this is what’s causing it, but I don’t know enough about nodes really to diagnose and fix the issue.

Most of my understanding of these nodes come from youtube videos that are great for building a layout, but not necessarily understanding the functions behind everything. I think I have a grasp on this particular setup, I’m thinking my main issue stems from the “SetMovementMode” nodes locking me in the “walking” mode after my character punches, preventing them from jumping, but I don’t know why this only happens sometimes and only once.


Would appreciate any help on this, thanks!

More than likely CMC movement mode isn’t set to walking and the capsule isn’t fully touching the ground.

Debug: On jump input → Print string movement mode → then call jump

Hey, thanks for the reply!
I discovered that usually the bug happens when the punch attack is called immediately after the jump is called. Observe this gif, and you’ll also notice the character snaps to the ground when the bug occurs. it’s very quick but it does happen.

My default land movement is set to walking. It’s specifically when I set it to walking that I can’t jump.

I never touched the capsule (which I assume to be the orange bounding box looking thing around my character). Should I try to move it lower so that it touches the ground earlier?

When printing a string on jump input, I can see the jump command going through despite my character not moving. is that what you mean? I hope i’m not misinterpreting anything! I’m not sure if you mean I should do “get movement mode”, since I don’t see that node available in my blueprint,

I should also mention that I’m an animator primarily, and I’m only doing this to create a template to paste my animations over. I might not be able to understand everything related to visual programming, but I will try my best to grasp everything, and I appreciate it nevertheless.

Thanks!

Orange boundy box is your collision cylinder, so ideally no don’t move it, this would result in your character floating off the ground

put a print string in the blueprint, try placing it in various places to see the state at different times throughout the code

connect your Enum “Default Land Movement Mode” to the print string

You can’t jump because Unreal’s movement mode that is built in is a tad wonky in the way it works

I used this video when i was learning how to play with the movement state, perhaps this will help you, even if you don’t add the slide it may help you see how to implement your attack

Also instead of animation montage might i recommend using the Animation Blueprint instead this way you can make a state machine for your animations and have a slightly easier time

This way you never have to do “Set movement mode”, which is what is causing the problems for you, the only sometimes is because sometimes it gets to the end just after play montage and the
“Switch on Name” is not “Anim Stop” its one of the other states, because “Play Montage” is a latent node, meaning it will finish later and not necessarily in the order executed, hence my recommendation to use state machines inside of an animation blueprint

Instead of all the code you have currently just keep the Boolean you have “Attacking”
then like in the 2nd video linked, in your Animation bp do the cast to character the way that he does, but you’ll be able to get your variable “Attacking” and do an animation based off if it is true or not, you could also detect if your jumping by having a bool attached to the code that makes you jump


^ this last one is essentially your code now but simplified
if were not jumping AND were trying to attack play animation

1 Like

This is a lot! I’ll try using blueprints on the next character I animate :). based off your description, can I define variables in the Event graph that lives in the Animation Blueprint? or do i have to define variables locally?

Alternatively, can I create variables in my Character Blueprint and reference them within my AnimBP?
Or is that a no go?

The reason I ask is because all the animations EXCEPT my attacks are already handled in state machines, and I couldn’t find a way to detect mouseclicks in the state machine. (but now I learned that left mouse click node exists, and I can possibly use that to set a bool to use in the transitions.)

Thanks for all the help!

Yes, you’ll likely want to do both

That is what the “cast to” node does, then we store it in a variable, you don’t specifically have to but storing a copy of what your “Working” on locally is a good idea in general

In your “Input Mapping Context” you can setup additional controls that you want to use, then find it in your character bp by searching “IA_YourControlNameHere”
so for example you might make a control called Attack and assign it to left click
then
IA_Attack>Set Bool ‘isAttacking’
In your animation bp you then read that variable, the animation plays and on the return ( when you go back to idle or whatever the state before ) just use the cast to, or the reference to it that you save

like in the upper part of this screenshot ( EventInitilizeAnimation>CastTo>SetVariable ) we save the casted reference to FirstPersonCharacter and can then use that variable later to change/read things from our character later without the need of a cast

1 Like

I see, so if I’m getting this right, I can set variables in the character event graph, which I can reference in other event graphs, like the AnimBP Event graph, as long as I cast those variables to the pawn/actor/character??? that owns it?

I’m realizing that I am a little lost on a few terms in Unreal in general haha

Casting is confusing to me. Like, if I have an object(A) that I want to gain access to variables/functions that exist on another object(B), I would need to cast Object(A) to Object(B)? or is it the other way around. All documentation on this specific behaviour is quite difficult for me to grasp, and I think I just need an explanation in dumb animator artist terms lol.

Really recommend checking out the rest of his channel as well, but this video should answer your question on how does “cast to” work

1 Like

Right, will have to check this out. Thanks for your help man :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.