How can NPC see player?

How can I make an NPC “see” using a 2nd (or non-default) camera.
I don’t want this camera to render to the screen. I only want to use the Spatial.checkCulling method to see if the NPCs camera can see my avatars spatial.
The following is semi-pseudo code hopefully explains what I’m trying to do.

[java]if((Spatial)myAvatar.checkCulling(npcCamera)) {

// true so I know that the NPC is facing me since the npcCamera is facing the same direction
Do a ray from NPC to me
if I’m the closest spatial to the NPC that the ray collides with {
NPC can react to me 'cause it can see me.
me -> RUN AWAY!


Take a few points of the player (head, shoulders, feet), make a ray cast check from the NPC eyes to these points. If you have no collisions you have a line of sight.

Yeah, I think I realise now that I don’t need a camera. I know which way is forward for the NPC. If the ray direction is greater than a configured value, then the NPC is turned too far around to see me. Otherwise make a ray cast as you suggested.



Note: the dot product will be a good friend.

Note 2: if you find yourself using “angles” in this calculation then you’ve done something wrong.