Rotation for 180 degrees of character

Hello I want to make a game where my character will move around planet. My character can go around planet only ahead or backwards and he is shooting by gun.
Script for player rotation on planet:

vectorNormal = transform.position - targetPlanet.position;		
		vectorCross = -Vector3.Cross(vectorNormal, transform.right);
		rotation = Quaternion.LookRotation (vectorCross, vectorNormal);
		transform.rotation = Quaternion.Slerp(transform.localRotation , rotation, Time.deltaTime * 5F);

Problem is that i need to character to rotate for 180 degrees when the gun is behind him. Script for it is:

if (gunRotationZ > 150 && gunRotationZ < 200) {  //Problem is not in this line.

     if (canRotate)
            {

    	       transform.Rotate (Vector3.up, 180, Space.Self);
    	       canRotate = false;
    		}
    		}
    		else
    		{
    		if (!canRotate)
    		{
    			transform.Rotate (Vector3.up, 180, Space.Self);
    			canRotate = true;
    		}
    	}

Problem is that transform.Rotate work well sinc i go with my character and fast rotating with the gun. He usually rotate for more or less then 180 degrees.

Thank you for answers. And sorry for my english. Hope you’ll understand my request

Hi, this is my answer but i found solution. I only need to change this:

vectorNormal = transform.position - targetPlanet.position;
vectorNormal.z = 0;
vectorCross = -Vector3.Cross(vectorNormal, transform.right);
vectorCross.z = 0;
rotation = Quaternion.LookRotation (vectorCross, vectorNormal);
transform.rotation = Quaternion.Slerp(transform.localRotation , rotation, Time.deltaTime * 5F);

And add this, to lock Z position:

Vector3 localPos = transform.localPosition;
localPos.z = 0;
transform.localPosition = localPos;