# Anyone have info on 3D Line-Of-Sight?

I need any info anyone can give me on 3d line of sight. I am making a 3d strategy game and could also use some info on pathfinding AI.

-Bredon Clay

• : I need any info anyone can give me on 3d line of sight. I am making a 3d strategy game and could also use some info on pathfinding AI.

Well, here's a primitive solution for determining what is along a particular line of sight if you're working in a polygon environment.

From the 'eye', compute a mathematical line that is along the line of sight. (In 3d this will involve 3 pairs of 2 parameters, each pair being the coefficients for the x, y, and z lines parameterized in, say, t.)

Searching from the nearest polygons to the furthest, compute the intersection of the mathematical line and the plane of the polygon. If the intersection point is both within the polygon and on the correct side of the 'eye' then the line of sight lands on the surface of that polygon.

The plane in which the polygon lies has x, y, and z components, so has 3 unknowns in its one equation. The line has three equations for x, y, and z defined in terms of t, so you have four unknowns.

This means you have four unknowns (x,y,z,t) and four equations (one from the polygon plane and three from the line). So you can solve for a unique x,y,z,t. However, that intersection point may be on the wrong side of the 'eye' (t is the wrong sign), and it may not be within the bounded polygon of the plane. Those tests will have to be done following the computation of the intersection point.

You could use something like this to see if anything blocks line of sight to a particular point in space by seeing if line of sight intersects with a polygon at a nearer point.

I don't know if this helps any...