Jump to content
  • Advertisement
Sign in to follow this  
Ender1618

Properly Mixing NavMesh Pathfing with Steering Behaviors

This topic is 998 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 I am working in Unity (5.x) Pro and have my AI agents moving about via calls to Unity's built in path finding and movement system (NavMesh base).

 

I also, in the past did alot of work with Reynold style steering behaviors, and had alot of nice (uselfull) emergent behaviors come about. But when I used them there was a low density of static obstacles, so a true global path finding solution was unnessisary.

 

But for this new Unity project, my maps have a high density of obstacles (also some areas of low density, e.g. large courtyards, etc), and a global path finder is quite nessisary (some places can be maze like).

 

So what I want to do is somehow properly mix NavMesh based path planning with Steering Behaviors (Evade, Chase, Formations, etc.). It is not quite clear to me how that would work.

 

The NavMesh does give me all walk-able areas, which I can query with ray casts. I also can compute paths from any location on the navmesh to any other location on the navmesh, without having to traverse them (Ive used that to know if even a path exists), but this is an expensive operation and can not be perform too often (like once an update frame, would not work). The number of AI agents I am dealing with right now is anywhere from 1 to 32.

 

I was just wondering if others have tried to mix these two movement systems, and how they went about it?

 

Thanks,

-Ryan

Share this post


Link to post
Share on other sites
Advertisement

In "Programming Game AI by Exampke" by Buckland (Great book) pathfinding is just another steering behavior. if pathfollow behavior is enabled, the behavior checks if the current waypoint is within a certain radius, and if it is, it sets currentwaypoint to the next waypoint in the path. It then  returns a vector to the current waypoint.

Share this post


Link to post
Share on other sites

Yeah, basically, you treat your next waypoint as an attractor that is "pulling" you and all the other objects you are trying to steer around as "pushing" you. Since you are guaranteed by the pathfinder and navmesh that you can reach the next waypoint directly (i.e. moving across a poly face), steering towards that waypoint should work fine. That way, you get a nice blend of "I'm trying to get over there but this crap is in my way." 

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!