Jump to content
  • Advertisement

Archived

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

DV8D

Field of vision

This topic is 6117 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
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.

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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!