Turn to Target slowly

Hi,

I have written an artillery script and for testing I used LookAt() in order to shoot. This is ofc unrealstic when using a cannon from the 19h century, as it immediatley 360 noscopes the enemy. So, I was wondering how I can force the gun to rotate slowly by the given rotate speed (public float). It should rotate towars the enemy (Vector3 enemy_pos)

Do I have to use a coroutine here?

It would be awesome if someone could give me some ideas how I can realize this

Use this method:

var q = Quaternion.LookRotation(target.position - transform.position);
transform.rotation = Quaternion.RotateTowards(transform.rotation, q, rotateSpeed * Time.deltaTime);

Ignore the below - but keeping it in case it helps someone

Use Transform.Rotate instead.

float rotateSpeed = 5f;
Vector3 direction = Vector3.right * rotateSpeed;
this.transform.Rotate(direction * Time.deltaTime);

You can change the speed of the rotation by using any direction multiplied by whatever speed you’d like it to turn at.