Jump to content
  • Advertisement
Sign in to follow this  
discodowney

Line of Sight

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

So im makign a line of sight AI for when a player character is in the line of sight of a guard it starts to chase you. Is ray casting the way to go for checking for Obstacles in the way? Ive got the distance and feild of view parts okay i think. Im just not sur ewhat the best method for checking for obstacles. Another way is to get the direction from the guard to the player and send out a ray in that direction to check for obstacles. Thats not real ray casting and i was just wondering whether people think that would suffice or i should go for the proper way?

Share this post


Link to post
Share on other sites
Advertisement
You need some form of collision query, definitely. It's sometimes called ray testing/checking. You can use most physics engine for these kinds of things, including Bullet or ODE.

You could just do a simple implementation by checking ray to obstacle bounding box intersections, but that wouldn't be too accurate.

Share this post


Link to post
Share on other sites
What you want is a Bounding Frustum. Basically, you take your camera position and an occlusion box and make a plane for each side of the occlusion box; each plane intersects all the other planes at the position of your camera.

Anything inside that occlusion frustum is not visible and can be ignored. You can mix that with portals to further speed things along. Also, you can instead use visibility frustums - This is largely a design choice dependent on how "open" your model space is.

Add in an octtree and you should have no speed problems for most things.

(Also, your LookAt matrix * your View Matrix is, essentially, AFAIK, a visibility frustum)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!