# Rotate player to movedirection

Hello,

im very new (just started today…) in UE4

Before i used Unity and have there my game working already, but i would like to recreate it in UE4 to see which i like more…

Now i have already a problem:

I have 3th person camera setup (self made not the provided one) and would like to rotate the player smoothly into the direction, in which he walks…

Example:
W - player facing up
S - player facing down

Heres a “Dev-Video” of the Unity version → and i just want to recreate this movement

Hope someone can help me

Well im really, really new to it so i have no idea how to calculate that
But i have seen something similar in the 3th person example, im going to try now if i get it working

If yes: You’ll read from me here
If no: Same as yes

If you use a Character as your basic Actor it automatically has a CharacterMovement Component, wich has the bool of Orient Character to Movement wich will do what you want.

Hi man ,
You can create a new vector. call it My_Direction.
When you use the input you set up My_Direction.
In the tick event you check if the char forward vector is == to your My_Direction.
If they are not equal , you have to calculate in wich direction you should rotate, and make your char rotate about Rot_value.
You can put Rot_value out , so you can change it at any time.

I assume that your vectors are normalized, this mean that they length is 1.
If they are not, you can use the normalize node to do it.

For calculate if the two direction are similar, , Subtract the two vectors,
and then pin out the Length node, if this value is < of 0.1, you are looking in that direction , otherwise not.
For calculate the left or right turn.
Its a bit more complicated, but like before, you can subtract the two vectors
to evaluate the difference between them.
You have to check the distance between 2 couple of vectors.
The forward vector and the wished direction.
This will give you an amount of distance but you dont know if is to right or to the left. so
Check also from the Right vector , and the wished direction.
So comparing the two distance you can know if is close to the right turn or the left one.

Try drawing it on paper and you will surely get it

Thats EXACTLY what i want

Thank you very much!