Sign in to follow this  

Is it possible to find line of sight with a navigation mesh?

This topic is 397 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

Hello, I assume there's an algorithm out there for this but I'm having trouble finding it.  I am using a navigation mesh to calculate paths and hope to use the mesh for determining line of sight as well, if possible.  I'm not very smart with geometry, I'd appreciate as much info as possible

 

Problem:

Players shouldn't be able to see around corners.  The server needs to be aware of what the player can see without relying on the client's view.  Raycasts will only work client-sided.  I prefer a cheap method that gives performance over an expensive method with great accuracy.

 

Diagram:

http://puu.sh/sdcRP/cc2b9fa39d.jpg

 

Marked yellow are vertex points that are within the line of sight, dark green M are enemies outside line of sight.  I can use client-side lighting to generate shadows and hide monsters accordingly however the server needs to be able to do this strictly by code.  It's not necessary to find line of sight in a 360 degree radius, I only need to know if point A can be seen by point B strictly by traversing vertex points on the nav mesh

Share this post


Link to post
Share on other sites

Raycasts will only work client-sided

 

Why?

 

A navmesh lacks some of the important information you need to do this correctly, because it tells you nothing about the gaps in the mesh. In your example picture, it has no way of knowing whether the gaps at the side of the ramps are open or if they're actually tall and impassible walls.

 

The algorithm you want is basically the raycast algorithm; so you may as well get the geometry working server-side.

Share this post


Link to post
Share on other sites

Yeah, maybe if your game has very specific requirements, but otherwise, a navmesh might make something impassible because it's a steep drop, water, or a half height wall.  Things that don't break LoS.  

 

It's not about relying on the clients view, the server knows where the player is and should be able to do the raycasts on it's side accurately.

Share this post


Link to post
Share on other sites

This topic is 397 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.

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