Line of sight

Started by
0 comments, last by Bob Janova 17 years, 1 month ago
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.
I dream hard of helping people.
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).

This topic is closed to new replies.

Advertisement