I often use transform.LookAt function in Unity but still I can not understand how to make the object rotation not to quick. I mean, look at this script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LookAtSlowly : MonoBehaviour
{
	
	public GameObject lookAtTarget;
	
    // Start is called before the first frame update
    void Start()
    {
        
    }
    // Update is called once per frame
    void FixedUpdate()
    {
        transform.LookAt(lookAtTarget.transform);
    }
}
This script will rotate the object (with this script attached) towards the transform target (the object that we look at to), but the rotation is too fast. How to make it slower and smooth?
After few tweaks, I finally came out with this:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LookAtSlowly : MonoBehaviour
{
	
	public GameObject lookAtTarget;
	public float rotationSpeed = 2.0f; // Adjust this for faster or slower rotation
	
    // Start is called before the first frame update
    void Start()
    {
        
    }
    // Update is called once per frame
    void FixedUpdate()
    {
        Vector3 direction = lookAtTarget.transform.position - transform.position;
		if (direction != Vector3.zero)
		{
			Quaternion targetRotation = Quaternion.LookRotation(direction);
			transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, rotationSpeed * Time.fixedDeltaTime);
		}
    }
}