Making My Character Face The Direction They Are Moving (3D RPG, Unity Input System)

I have recently cracked being able to get my 3D character to move in a 3D world using a gamepad through Unity’s Input System. However, no matter which direction they move, they always face the same direction. I just want them to be able to face the direction they are moving and keep facing the direction they were in when they stop moving. I don’t know if the Input System and my current code changes how that is done, so I’m posting the code I have just to be safe. If anyone knows a script that can work for me, please let me know.

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.EventSystems;
 using UnityEngine.InputSystem;
 using UnityEngine.Scripting.APIUpdating;
 
 public class PlayerController : MonoBehaviour
 {
     PlayerControls controls;
 
     Vector3 Movement;
 
     void Awake()
         //Controller input roles
     {
         controls = new PlayerControls();
 
         controls.Gameplay.Movement.performed += ctx => Movement = ctx.ReadValue<Vector2>();
         controls.Gameplay.Movement.canceled += ctx => Movement = Vector3.zero;
     }
 
     //Joystick controls
     void Update()
     {
         //Character Movement
         Vector3 m = new Vector3(Movement.x, 0, Movement.y) * Time.deltaTime;
         transform.Translate(m, Space.World);
     }
 void OnEnable()
     {
         controls.Gameplay.Enable();
     }
 void OnDisable()
     {
         controls.Gameplay.Disable();
     }
 }

For those following the question, I figured it out. For anyone wanting good third person movement with a gamepad, the YouTube channel Brackeys has two two videos out that you can use to get the results you want.

Gamepad Input Tutorial (Need Input System): CONTROLLER INPUT in Unity! - YouTube

Third Person Movement (Need Cinemachine): THIRD PERSON MOVEMENT in Unity - YouTube

Following this will allow you to make a character that moves around relative to the camera. They will face the direction they are moving and smoothly transition between directions they are facing. The only issue I have left is I cannot control the camera movement with the right joystick yet, but I have already posted a question about that.

By the end of it I had a movement script that looked like this:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;

public class ThirdPersonMovement : MonoBehaviour
{
    PlayerControls controls;

    Vector3 Movement;

    public CharacterController controller;
    public Transform cam;

    public float movementSpeed = 6f;

    public float turnSmoothTime = 0.1f;
    float turnSmoothVelocity;

    void Awake()
    //Controller input roles
    {
        controls = new PlayerControls();

        controls.Gameplay.Movement.performed += ctx => Movement = ctx.ReadValue<Vector2>();
        controls.Gameplay.Movement.canceled += ctx => Movement = Vector3.zero;
    }

    // Update is called once per frame
    void Update()
    {
        //Character Movement
        float horizontal = Input.GetAxisRaw("Horizontal");
        float vertical = Input.GetAxisRaw("Vertical");
        Vector3 direction = new Vector3(horizontal, 0f, vertical).normalized;

        //Character Rotation
        if (direction.magnitude >= 0.1f)
        {
            float targetAngle = Mathf.Atan2(direction.x, direction.z) * Mathf.Rad2Deg + cam.eulerAngles.y;
            float angle = Mathf.SmoothDampAngle(transform.eulerAngles.y, targetAngle, ref turnSmoothVelocity, turnSmoothTime);
            transform.rotation = Quaternion.Euler(0f, angle, 0f);

            Vector3 moveDir = Quaternion.Euler(0f, targetAngle, 0f) * Vector3.forward;
            controller.Move(moveDir.normalized * movementSpeed * Time.deltaTime);
        }
    }

    void OnEnable()
    {
        controls.Gameplay.Enable();
    }

    void OnDisable()
    {
        controls.Gameplay.Disable();
    }
}

Feel free to copy and paste this, just know that you will need the Input System and the Cinemachine Freelook camera. If anyone has any questions about this, let me know, I might be able to help.