Moving Game Object With Smooth Rotation In Unity

using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
    public float speed = 80f;            // The speed that the player will move at.

    public float smooth = 5.0f;
    public float tiltAngle = 10.0f;

    public float maxYPos = 5f;
    public float maxXPos = 5f;

    Vector3 movement;                   // The vector to store the direction of the player's movement.

    Vector3 position;

    void Update()
    {

        // Max position can reach by player
        position = transform.position;
        position.y = Mathf.Clamp(position.y, -maxYPos, maxYPos);
        position.x = Mathf.Clamp(position.x, -maxXPos, maxXPos);
        transform.position = position;

        // Smoothly tilts a transform towards a target rotation.
        float tiltAroundZ = Input.GetAxis("Horizontal") * tiltAngle;
        float tiltAroundX = Input.GetAxis("Vertical") * tiltAngle;

        // Rotate the cube by converting the angles into a quaternion.
        Quaternion target = Quaternion.Euler(-tiltAroundX, tiltAroundZ, 0);

        // Dampen towards the target rotation
        transform.rotation = Quaternion.Slerp(transform.rotation, target, Time.deltaTime * smooth);


        // move player forward
        transform.Translate(Vector3.forward * speed * Time.deltaTime);


    }

}
Ask or Request for anything you want in the comments below 😀