LookAt makes my player face the wrong side

I apply transform.LookAt on my player’s gameObject to face one enemy gameObject and then another, and the player ends up facing the wrong side in both cases.

Below I pasted the code and a screen capture of the editor view seen from above, with text explaining what happens when my player looksAt one enemy and when it looksAt the other one.
I hope it helps understand what’s going on.

I’ve seen a response from @aldonaletto to another similar question and other similar questions about LookAt, but I don’t know how to apply them to solve my particular case.

This is the code:

	Ray ray = viewCamera.ScreenPointToRay (Input.mousePosition);
	Plane groundPlane = new Plane(Vector3.forward, Vector3.forward * gunController.GunHeight);

	float rayDistance;

	if (groundPlane.Raycast(ray, out rayDistance)) {
		Vector3 point = ray.GetPoint(rayDistance);
		crosshairs.transform.position = point;

		RaycastHit hit;
		if (crosshairs.DetectTarget(ray, gunController.equippedGun.range, out hit)) {
			//if target detected at x/y/z, aim at it
		else {
			//if no target detected in z axis, aim at x/y/0


Any ideas anyone?

After calling the LookAtfunction, you can apply a rotatin of 90 degrees so as to counterbalance the wrong rotation of your player :

player.transform.LookAt( target ) ;
player.transform.Rotate( 0, 90, 0 ) ;