<p>I have an object, that is facing a particular direction with (for instance) a 45 degree field of view, and a limit view range. I have done all the initial checks (Quadtree node, and distance), but now I need to check if a particular object is within that view cone, (In this case to decide only to follow that object if we can see it). </p>

<p>Apart from casting a ray for each degree from <code>Direction - (FieldOfView / 2)</code> to <code>Direction + (FieldOfView / 2)</code> (I am doing that at the moment and it is horrible), what is the best way to do this visibility check?</p>

Compute the angle between your view direction (understood as a vector) and the vector that starts at you and ends at the object. If it falls under FieldOfView/2, you can view the object.
That angle is:
```
```
arccos(scalarProduct(viewDirection, (object - you)) / (norm(viewDirection)*norm(object - you))).
```
```