"Play Animation" Stops character movement

Hello everyone,

I set up an AI character than can run around and search for me, I set a “Play Animation” so that when I shoot it, it reacts to my bullet hits, it plays well and everything, the problem is that after the animation, my character’s movement animation stops and it starts sliding around on the map.

The Play Animation node isn’t exactly smart in the sense of recovering and resuming.

I’d recommend checking out the Animation Blueprints. They’re much much more robust and user-friendly when it comes to things like this (switching states and then resuming after some logic is assessed).

I was afraid you would say that :frowning:

I have watched almost every tutorial there about animation and you have no clue how confused I get to the point where I start getting a headache when it comes to statemachines and switching between animations… I bought the Animpro Pack and I still can’t figure out anything more than just walking my character walk and jump…

But thanks for your answer

Sorry, wish I had better news! There are some great examples included in the ContentExamples on the Marketplace.

What are you trying to accomplish in particular? Maybe I can help you with setting up an animation blueprint for that.

An AnimBP contains a set of tools that make selecting and blending animations on your character straightforward. But think of the AnimBP as just controlling the animation. The AnimBP gets sent values and information from the player’s BP, and plays the right animation accordingly. Does that make sense? Some good starter info:

Intro to ABPs: - YouTube
Intro to ABP State Machines: - YouTube

Yup, that was the first video I have watched but for some reason I still don’t get it with my thick head…

I am only 1 month old in game development, I’ve had this idea for a game that I’ve wanted to make since like 5 years but I didn’t know where to start, the idea was original at that time “Now taken by the game Evolve” But I still have a twist for it that they didn’t do.

I heard about UE4 and I am now trying to start somewhere, the problem is that I have 0 experience with game design… But I think if I have something solid to show in a presentation I think I can sell the idea to at least an indie studio that would be interested in it.

That is the long answer for your question, the short answer is:
I just want a character that does this Movement Animset Pro: Gameplay usage example - YouTube

If you know of a small team that has the skills to work on a game, I am willing to invest small amounts of cash to take it step by step to at least a phase where I can present the idea to someone who can carry on with it.

Sorry for the long reply, and thank you for your time.

TLDR version at bottom. =)

All State changes are driven by transition rule, either going false or true.

Transition rules are the arrows you see between 2 states. Sometimes they are both ways. If you mouse over the “circle”, you will see the transition rule’s view, and double clicking on it will let you see it clear.

If you check Anim BP’s Event Graph, you will see that “Is In Air” is constantly checked every frame. ın the same event graph, you see that we use “Get Pawn Owner”, then it’s movement component. Movement components got a function, and it is called “Is Falling”, which is determined if the character is currently touching on a ground, aka a static mesh that blocks him. This little guy is connected to “IsInAir” variable and the moment “ıs Falling” is true (Aka mesh not touching to anything below that stops him from falling), the IsInAir variable also becomes true.

If you check the basic Unreal 4 skeletal mesh Anim Graph, you will see that, in the first transition it asks “Is in Air?”. If it is true, then the mesh starts to play the Jump Start animation. At the same time, you have pressed jump, so it mesh also jumps up, which causes you to see both mesh animation and raising up simultaniously, giving the feeling that it all happened because you pressed the jump button.

This is how generally things work. Animation BP updates itself every frame to check the situation of its variables and change the states accordingly to the transition rules between.

Let’s give it a simple example;

Imagine your mesh got one Idle Animation, and one Battle Stance Animation, aka a second Idle Animation that you want to switch between whenever the player is in battle.

Your Player Mesh would have a variable, a boolean called “IsInBattle”.
Let your Anim BP have a variable, a boolean called “IsFighting?”. Names could be same, but let’s not confuse it now.

In your event graph of your Animation BP, you would get “Try get Pawn Owner” → “Cast to Mesh” → “Get IsInBattle” Var → Connect it to “Set IsFighting?”. Basically what we have done is the same thing you see in the basic Mesh Anim BP, the only difference is we are not checking with IsFalling, rather getting the variable IsInBattle and connecting it to IsFighting?.

Now, in the Anim Graph part of your Mesh, first create a State Machine and connect it to Last Animation Pose (I think I remember the name wrong but its that mannequin guy node). Double click on your State Machine. It will have an “Entry node” at beginning. Now create 2 “States”. Call one “Idle”, Other one “Battle”. First connect the Entry to Idle State, then connect “Idle” to “Battle”, lastly connect “Battle” to “Idle” aswell. If you do this correct, you would see two arrows, with two transition circles.

Also don’t forget to add one animation to each Idle and Battle States by double clicking on them. =)

Get inside the “Idle → Battle” transition rule and get “IsFighting?” var and simply connect it. Do the same for the other transition and make it “Is Fighting + NOT”.

If you play now and set the boolean var of your mesh which is called “IsInBattle”, you would see that your mesh is going from one pose to another depending on the variable.

TLDR version : Watch Unreal Engine “Creating Player Mesh from Beginning” tutorial at Youtube. It explains all. ^^

1 Like

Wow dude, I really appreciate your effort and time in that great reply. I managed to figure out the anim graph which has lots of logic and makes sense. My main problem since I have 0 experience with programming is the eventgraph, I managed to get the Animset pro character movement setup but I didn’t know how to use it since most of the animation tutorials use a 1D space.

I even contacted the creator and asked him for help, he told me he is a unity user and he has no clue how to make it work on UE4

For Event Graph, you better watch some simple Blueprint tutorials. Because that event graph is exactly same with others one. Only that it got an “Update Animation” node you see at the very beginning.

To be honest I do not use Event Graph that much and I do not believe the constant checking of IsInAir is a good example for a beginner. Such a thing can be set to true or false inside the Player_BP easily and you wouldn’t have to check for it everyframe, but only update when the player presses a button and simply turn it to false when IsFalling is false by doing the check once.

Also Event Graph is useful for Anim Notify events etc but that’s another story. Still if you got questions about Event Graph, many people would gladly help here. :slight_smile:

So say for example you have “True” instead of “IsInAir?”, Can you use “True” to check if anything is “True” or not? Or would that “True” become = “IsInAir?”

Hope that was clear

Ah. I think you are confused about variable naming.

Variables can have any names. It’s just, having a boolean named True would work, but it would confuse yourself. Because as the time goes on, your character could have 30 booleans to check if they are true or false. Having one named True would confuse yourself, not the engine.

Go ahead and change the IsInAir variable’s name to SuperHappyPony. It will still work because IsFalling component is changing the value of SuperHappyPony’s to true when itself is true and viceversa. What is important is the transition rule.

What is changing the state is not the name of the variable, but what it actually does in the transition rule after being changed. IsInAir is not a special variable name. It could be anything. =)

Say I have a Boolean named “whatever” in my event graph, and I created another Boolean with the same name in my character BP, would that be treated as the same Boolean and would be called there or would those be 2 totally different ones?

That wouldn’t matter. You can have 30 booleans named Whatever, or 300 in your whole project and it wouldn’t be a problem. Here is why.

First, create one variable named Whatever in your Anim BP and in your character BP.

Let’s reach out for your Whatever variable in your Anim BP’s Event Graph, that one is you already know; Simply right click on a free event graph place and “Get Whatever.”

(Done in AnimGraph BP’s Event Graph)

Then this is what you get;

Now, let’s get the variable in Player BP. Same procedure;

(Done in ThirdPersonBP’s Event Graph)

And here is what you get;

As you see, Engine does not mix which variable is which, regardless of having same variable. But, what if you want to reach out the variable of ThirdPersonPlayer BP in it’s Anim BP? Here is how.

First right click on Anim BP’s Event Graph and type “Try get pawn owner”. This is a speical way to reach for another Blueprint that is using this anim BP.

Second, click and drag from it’s return value and release it over the graph. From the menu type “Cast to ThirdPersonCharacter”.

Right click on the cast node, and make it impure. This is not needed, but just so you don’t need to have connections.

After that, drag the “As Third Person Character” to event graph once again, in the menu, notice that it says “Actions Taking … Reference”. Meaning that right now you are acting like you are in Third Person BP. Whatever you drag out, will belong to the Third Person BP and let’s see what happens. Now let’s get the variable “Whatever”. Note that this one belongs to Third Person BP, not the Anim BP.

Here is the result;

As you see, the engine does not care about the variable names. It all could be same because the way you get the variables in their own blueprint, and calling them in other blueprints are different, which we call as Casting.

There are other ways ofcourse, using Blueprint Interfaces for shared variables etc but that is another story.

The only reason of not using same variable names (like Engive Devs used “Is In Air” instead of “Is Falling” in Anim BP) is not to confuse yourself. =)

Hello! I hope you don’t mind that I took your advice, but my animation is not working, it still does not play the normal idle/run/jump animation after I do my animation, is this because my cast is not connected to anything? I currently have 2 states connected to Idle, the first state is the start of the animation, and the second is the end, could you help?

Well I am having little luck trying to cast to char other then that of the inherited class. Did what you suggested and tried it from different angles. I continue to get an error as discussed in my earlier post which also relates to this post; https://answers.unrealengine.com/questions/457388/exposing-public-variable-between-bps.html.

Would greatly appreciate it if you can show a screen shot of my scenario which I believe mimics what you have also outlined.

Here is my last attempt which is also generating an error when I try to cast it then assign to the characters mapped boolean value

Thanks mate,