Quaternion.Angle question

Hi. I am trying to make something happen only if the player is looking approximately in the targets position. I tried to use the Quaternion.Angle function but it only works if the enemy is looking at the player, And stops working when the enemy turns away.

This is how i did it.

					if(Quaternion.Angle(transform.rotation,pc.target.transform.rotation) > 170
					&& Quaternion.Angle(transform.rotation,pc.target.transform.rotation) < 190){

My question is how can i ignore where the enemy is looking and only compare the players rotation with the targets rotation?

You use LookRotation.

Simply find the rotation you would have if you were looking directly at the target:

Quaternion wantedRotation = Quaternion.LookRotation(target.transform.position - transform.position);

Find the angle between it and your current rotation:

float angle = Quaternion.Angle(transform.rotation, wantedRotation)

And do something if the angle is below a certain treshhold:

if(angle < 20f) { 
    DoMyThing();
}