# Player character spinning in place when trying to rotate

``````        //Get Input from Horizontal and Vertical Input Axis (Can either be WASD keys or
//controller left Stick or D-Pad keys ðŸŽ®)
float x = Input.GetAxisRaw("Horizontal");
float z = Input.GetAxisRaw("Vertical");

//Construct vector to move the character by, but remeber to multiply these input values
//with the forward and right character vectors this will transform the movement from the global axis to
//local
Vector3 move = transform.right * x + transform.forward * z;
//Vector3 move = new Vector3(x, 0.0f, z);
if (move.sqrMagnitude == 0)
return;

//VERY IMPORTANT, NORMALIZE MOVE VECTOR BEFORE USING IT
move.Normalize();

if (move.sqrMagnitude > 0.0f)
{
//Rotation
var targetRotation = Quaternion.LookRotation(move, Vector3.up);
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, smoothTime);
}

characterController.Move(move * Speed * Time.deltaTime);

``````

Iâ€™m calculating the movement based on the forward and right player vector, but when trying to also rotate towards the forward vector the character just ends up spinning whenever I try to make it turn.
I getting the impression that the character is spinning because Iâ€™m constantly changing the forward direction because of the rotation while trying to move towards it at the same time (when pressing one of the WASD keys)

I apologize for the very basic question but Iâ€™ll get all the help I can get. Thank you

Your guess is correct. Through rotating it, the forward direction of the character changes, and thus, so do the two vectors you use to calculate the next move direction.

@FlaSh-G but then comes the questionâ€¦ How are you supposed to rotate a character that moves based on the direction theyâ€™re facing? Isnâ€™t that how movement is done in most third-person games? (I know there are other types of movement)â€¦

I managed to find a tutorial on how to do 3rd person character movement and it implements the type of movement that I was trying to go for.
Brackeys Third person character movement
Thanks so much for trying to help me @FlaSh-G