Question about Vector3.Angle

So im using this script to rotate object if its facing to another,but i can rotate it only in one side.

How can i check left or right side?

	void Update ()
	{
		forwardAngle = Vector3.Angle(player.transform.forward, transform.position - player.transform.position );
		
		float angle = 10;
		
		if (forwardAngle < angle) 
		{
 				transform.RotateAround(player.transform.position,Vector3.forward,5);
							
		}
		//if faces from another side transform.RotateAround(player.transform.position,Vector3.back,5);		
		
	}

[13715-без+имени-2.png|13715]

See this post for an answer to finding a signed angle:

http://answers.unity3d.com/questions/181867/is-there-way-to-find-a-negative-angle.html

You could possible compare the x values, for instance:

if(player.transform.position.x > otherObject.transform.position.x)
{
    //The player is to the right of the object
}
else
{
   //The player is to the left of the object
}

If you need something more please try and be a little more descriptive of what you are trying to do.

My guess at what you’re running into is something about angles wrapping around.

I think you could probably compare against 360-angle to find the other direction

13718-deg.png

If I understand your problem, you can figure out if they’re within +10 degrees from forward, but not -10 degrees. So:

if (forwardAngle < angle) 

gives you one side
and

else if(forwardAngle < 360-angle)

gives you the other side