• Advertisement
Sign in to follow this  

Line of sight

This topic is 4014 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 looking for a line of sight alogrithm that can detect if an object can be seen by another object, taking into account blocking geometry. I could give the unit a radius, field of view and direction, but it still doesnt account for blocking geometry. I can try a series of rays, but this of course could lead to false negatives, the object is flagged as not visible but its only because too few rays were cast. Increase the number of rays and the accuracy increases, but preformance takes a hit. I read in some thread about using a software renderer z-buffer but I am not too sure. To make matters worse its for an RTS game.

Share this post


Link to post
Share on other sites
Advertisement
A typical rough-and-ready algorithm would be something like a combination of the two. First you check if the units are close enough and in the right direction to see each other – whether they could see each other with no blocking. Then draw one (or more if you need more accuracy, for FPSs perhaps five, one to each corner and one to the middle of the projected BB) ray from unit to unit and check it for intersections against potential blockers (terrain and units in that part of your spatial partitioning scheme).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement