Make a side of an object LookAT another object

Basicly I have 2 ships, one is controlled by the player and the other by the computer.

I have a script where the AI Ship rotates towards the player and starts moving towards him.
But, once within firing range, it needs to rotate around 90 degrees left or right so that the cannons on either side can have a shot and that is where i’ve been having difficulty.

I’ve tried multiple methods but none have worked, seems that i’ll never understand Quaternions.

else if(Vector3.Distance(transform.position, player.position) < firingRange && Vector3.Distance(transform.position, player.position) > retreatDistance)    //If in firing range
	//stop moving
	transform.position = this.transform.position;

	//rotate & fire    
	Vector3 fireAngle =  transform.rotation * new Vector3(0,90,0);      //add 90 degrees on Yaxis
	Quaternion rotation = Quaternion.LookRotation(fireAngle);
	transform.rotation = Quaternion.Lerp(transform.rotation, rotation, turnSpeed + Time.deltaTime);

Any help would be greatly appreciated as I’ve been stuck in this part for way too long


You can grab the direction of the target, and then set the side of your ai ship to point at the direction.

var direction = (target.transform.position - aiShip.transform.position).normalized;
// Set the right side to point at the direction    
aiShip.right = direction; // You could slerp this to make the transition more smooth instead of instant

You’ll have to rotate to left or right based on which side is the fastest to turn towards the target.
I assume you could use Dot product for this.