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 
        Vector3 move = transform.right * x + transform.forward * z;
        //Vector3 move = new Vector3(x, 0.0f, z);
        if (move.sqrMagnitude == 0)


        if (move.sqrMagnitude > 0.0f)
            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) :thinking:

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)…:thinking:

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 :+1::smile: @FlaSh-G