(Solved) How To Stop Player's Movement When Animation Is Played?

Hello everyone,

I am designing a scripted event in Blueprint for my Player Character to play his animation without the Controller able to move once the animation begins. Please note that this is for my Third Person game that I am currently working on.

As you can see, this is the Taunt Action script that makes the Character play her animation. However, the Character is still able to move around during the animation being played.

I had tried using the “Disable Character Movement” function in this Blueprint script, but I did not know how to reactive the Controls or Movement for the Character to move again, unfortunately.

I would like to have the Player to not be able to take control of the Character after the animation sequence has been finished.

Does anyone know how to solve my issue that I want for my Character to have or any Tutorials to know about it?

Thanks in advanced,

Kyle Carpio.

Disable input before playing animation(Putting the disable input node just after the button press event would be good). Enable input again once the animation is played.

212666-ss4.png

2 Likes

Thank you, BladeMaster.

Also, how would I be able to “Enable Input” my Camera for the Player Character to rotate when the animation is played?

That’s a bit trickier. How are your camera controls set up? Camera control is usually dictated by player controller input.

If you want your character to stop moving while an animation is playing but still have camera controls, you’ll need to leave player controller input on. One solution would be to reduce character movement speed to 0 when the animation plays, then setting the value back when the animation ends. Another would be to freeze X & Y values dynamically when the animation plays.

Hello H_C_C,

My Camera controls are set with a “Camera” attached to “Camera Boom” with the simple “Add Controller Pitch Input” and “Add Controller Yaw Input” in the Event Graph.

I have tried your first solution in which have worked, however, the Player can still move around the dot, messing up the animation and looking funny as the Character slides around. Although, I have not attempted to try your second solution just yet because I do not know how to freeze the X & Y Values.

Hm. I’m not near a machine with unreal on it right now, so I don’t want to instruct off memory.

I’m pretty sure there’s a bunch of ways to do this but… If all else fails, you can go the long route by:

  1. Creating a boolean variable named something like “Character Movement toggle”
  2. When an animation plays, set the bool to false. When the animation finishes, set the bool to true.
  3. Now you can configure your input keys (wherever your character movement is set up, probably player controller?). So for example, if key 'W" is for moving forward, then just before it executes any actual movement, do a check for whether the character movement toggle boolean is set to true. If true, then branch off to execute movement input. If false, then it can lead to nothing.

Alright, well I will try to find other ways to get it working correctly.

Also, I think it’s best for me to see it better when I see the Event Graph on how you mean by these steps. Sorry if I sound noobish but I am still a learner to Unreal Engine 4.

It doesn’t seem to work for me… I passed in the character controller, to the second pin as shown, and it seemed to have no effect (I have it wired in though).

This was on the right track, I found out you also have to pass in the player character in the top node of disable input and enable input. This video shows how to do it: Unreal Engine 4 Tutorial - Disable/Enable Input - YouTube