// Update is called once per frame
    void Update()
    {
        // Check if the vehicle is currently turning
        if (waypointscript.GetUpdateWaypoint())
        {
            Vector3 Direction1, Direction2;

            // Checking which direction the vehicle is turning
            Direction1 = waypointscript.transform.rotation.eulerAngles;
            Direction2 = waypointscript.GetObjectRotation().eulerAngles;

            if (Direction1.y < Direction2.y)
            {
                LeanRight();
            }
            else if (Direction1.y > Direction2.y)
            {
                LeanLeft();
            }
        }

        // If the vehicle is not turning
        else
        {
            lean = Quaternion.identity;
        }

        // Update the camera to lean in either direction or not lean
        UpdateRotate();
    }
    // Update is called once per frame
    void Update()
    {
        // Calculate wheels rotation forward
        wheelsXRotate += (body.velocity.magnitude / 340.0f) * MaxRotationSpeed * Time.deltaTime;

        if (wheelsXRotate > 360)
        {
            wheelsXRotate -= 360;
        }

        forwardWheelsRotation = Quaternion.AngleAxis(wheelsXRotate, Vector3.forward);

        // Calculate the amount to turn the wheels on Y and steering on Z
        if (waypointscript.GetUpdateWaypoint())
        {
            Vector3 Direction1, Direction2;

            // Checking which direction the vehicle is turning
            Direction1 = waypointscript.transform.rotation.eulerAngles;
            Direction2 = waypointscript.GetObjectRotation().eulerAngles;

            if (Direction1.y < Direction2.y)
            {
                float angle = Mathf.Clamp(Direction2.y - Direction1.y, 0, MaxRotation);
                wheelsRotation   = Quaternion.AngleAxis(angle, Vector3.up);
                wheelsRotation  *= forwardWheelsRotation;
                steeringRotation = Quaternion.AngleAxis(-angle, Vector3.forward);
            }
            else if (Direction1.y > Direction2.y)
            {
                float angle = Mathf.Clamp(Direction1.y - Direction2.y, 0, MaxRotation);
                wheelsRotation   = Quaternion.AngleAxis(-angle, Vector3.up);
                wheelsRotation  *= forwardWheelsRotation;
                steeringRotation = Quaternion.AngleAxis(angle, Vector3.forward);
            }
        }
        else
        {
            wheelsRotation   = forwardWheelsRotation;
            steeringRotation = Quaternion.identity;
        }

        UpdateRotate();
    }