• Create Account

### #ActualBacterius

Posted 12 November 2012 - 12:10 AM

No, it should work, I guess, but you'll probably need more than one ray to sample the character's field of vision. You might also want to take into account peripheral vision (at the edges, humans react better to visual stimuli, but discern less). So for instance, you could try and cast a ray from the character's eye to a bunch of enemies that are potentially in sight (perhaps throw a few rays for each enemy, to estimate how much of the enemy is actually visible), multiply this score by the enemy's rough position with respect to the character's field of vision (this can be done approximately with a dot product of the ray with the character's eye vector, i.e 1 if the enemy is directly in front of the character, falling smoothly to 0 if he is out of his field of vision), and trigger a response when the result is above a certain detection threshold.

### #1Bacterius

Posted 12 November 2012 - 12:09 AM

No, it should work, I guess, but you'll probably need more than one ray to sample the character's field of vision. You might also want to take into account peripheral vision (at the edges, humans react better to visual stimuli, but discern less). So for instance, you could try and cast a ray from the character's eye to a bunch of enemies that are potentially in sight (perhaps throw a few rays for each enemy, to estimate how much of the enemy is actually visible), multiply this score by the enemy's rough position with respect to the character's field of vision (this can be done approximately with a dot product of the ray with the character's eye vector, i.e 1 if the enemy is directly in front of the character, 0 if he is out of his field of vision), and trigger a response when the result is above a certain detection threshold.

PARTNERS