Field of vision
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?
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement