Archived

This topic is now archived and is closed to further replies.

DV8D

Field of vision

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites