Field of vision

Started by
2 comments, last by DV8D 22 years, 6 months ago
I am trying to implement some sort of "line of sight" algo. I am currently using a portal like solution where I clip enemies against the players "viewportal". It works fine as long as my enemies are in an open area. But if they hide behind a box or something they still is tagged as visable in my portal test. See here if for an example http://www.angelfire.com/nv/qonjure/lineofsight.htm My example is in 2d but I wanna solve this in 3d. Any ideas?
Advertisement
Just check a line between the player and the enemy. If the line''s clear there''s no obstacle in the way and the enemy is visible.
The enemy might only be partially hidden though.

Anyway, sounds similar to the very fun topic of hidden
surface removal.

I''m not very graphic-savvy, hidden surface removal might
not be the right term, but use whatever method your engine
uses to not show objects that are behind other objects,
and as you go along test to see if an object is an enemy
and then flag the enemy as not seen.

Of course I could still have the wrong idea of the problem
in my head(I haven''t followed the link).
If you''re talking a line, as in a laser beam,
then I think ray-tracing is what you need.
Or maybe not ray-tracing, but instead the test for an
intersection between a line and a surface.
Please follow the link to get a better understanding of my problem. As anom. poster wrote, the enemy could be partially hidden so a raytest would not to the trick.
About the "hidden surface" solution. As I don´t have zero overdraw in my engine that would be hard. Thanks for your answers.

This topic is closed to new replies.

Advertisement