General Category > General discussion

Line of sight/ clear shooting trajectory


Hi all,

I have spent few hours developing a nice little game with FIFE. I must say I really like it.

I hit a wall though, and that is getting a way to calculate if my units have clear line of fire to other units. I use a square grid.

So far what I tried is calculating two different routes from unit to target: one in the "units" layer and another one in a so called "trajectory" layer which has no blocking objects (it would take the shortest path possible). So if the paths match, then I have a clear line of sight. This works in most of the cases, but there are some exceptions when it doesn't work.

How would you do it?


Wow, I think I found it.  ;D

I'm now using:
 layer.getInstancesInLine(origin, destination)

I haven't totally implemented and tested it but it looks promising. Still open for feedback.



[0] Message Index

Go to full version