Character mesh rotates as intended but movement always stays positive

I am looking to be able to face either left or right, and run forwards or backwards in either direction. I have my anim blueprint working as intended and speed ranging from -600 to 600 and it works. But I cannot seem to get the movement component to register movement in the negative - my guy runs forward no matter what. Any ideas?

Hi Teichroeb,

A simpler way to get the direction, and stay with me on this one :wink: , is to capture the starting point versus the end point. Same logic as trying to figure out a swipe direction… kind of.

See screenshot Image 1.png. I capture the start position (in your case it would be the players position) then I capture the end position (in your case, it would be the mouse position). I then do Start - End and break that result in a 2D vector. Then I do a greater then 0.

If it’s greater then 0, it means we are going left. Otherwise, we are going right. Once you have that information, it’s easy to determine and assign the speed the player should be going.

See screenshot Image 2.png, Now I don’t rotate my player, I just flip him but concentrate on the Move Player section. As you can see, since I am not using the keyboard to control the direction, I have to tell him what value to use in order to move. I keep track of the direction the player is facing in a boolean but that is optional.

Hope this helps.

Thank you for your answer, I will try this out later tonight. I believe that the key here is the “add movement input” node.

exactly, that’s the most important one. I just wanted to put in how I detected the side the player had to go.

If you want him to run backwards, How to you get him to rotate other then running in an 180 degree ark? The only way I can see this is if you have one key to run forward and one key to move backwards. am I right? If so associate the proper animation to the proper key.

Anyways, have you tried blending animation? I use it to go from Idle to running without changing anything in my code.

See here → Unreal Engine 4 Tutorial - Blend Walk/Run (ThirdPersonTemplate) - YouTube

and

see here → - YouTube

So, I was rather unsuccessful last night, but maybe I worded my question incorrectly. My character faces left and right correctly already, and can move forward or backward properly. The problem is that his animation is always “running forward” so sliding his feet along the ground as he runs in reverse in either direction. I cannot seem to get the Character movement component to register that I want to run backward while facing in either direction. Any ideas?

My blend is already setup and working in Persona. The speed is from -600 to 600, and the animation works as intended (running forward and backward) The problem is I can’t get -600 speed in the game because anytime I move, its just positive speed

So from that, I would say there’s a minor glitch in your logic that you are using. How exactly are you handling movement (what are the keys) and how do you want it to handle?

ex. when I press right, it goes right and if I press left, it goes backwards for a couple of seconds and then turns around.

So I ended up figuring it out, I was close already, I just needed to multiply my speed by -1 after determining what keys are pressed while I’m facing each wa

http://i.imgur.com/A5FfMRf.png

y.

good to hear that :wink: