Sign in to follow this  
Aiursrage

Line of sight

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this