Just for context I’m creating a FPS.
So I’ve found through searching the forums and a bit of experimentation of my own that the navmesh generator doesn’t take into account static obstacles added to the map, so in my navigationControl class I’m seeking to add a bit of code to avoid obstacles I might have littered around (things like crates, furniture etc).
Now I have a proposed solution but something about it just seems inefficient and I’m wondering if there is a better approach.
So this is the approach I’m still in the process of implementing:
An arrayList of spatials is inputted containing all possible obstacles.
Clones of the bounding boxes of these spatials are then saved into a list with the radius of my NPCs collision shape added to the X and Z extent (an easy way to see if an object fits between two obstacles is checking for overlap - something I picked up from navigation in robotics).
A quick cycle through the list of bounding boxes merges any that overlap.
This is the initialisation phase. This list of bounding boxes may only have to be computed once depending on the flexibility of my scene. (Can I move chairs etc around? Is it going to be truly dynamic etc).
Now this is what will be done each time a path is computed.
A ray will be created between two adjacent waypoints and checked against all bounding boxes for an intersection. If there is an intersection create path around it.
Repeat for every adjacent waypoint pair.
Naturally I could optimise this by checking for bounding boxes in the cells of the navmesh between the two waypoints and by storing the bounding boxes using a data structure with spatial (in terms of space not the object) access methods but first step is to get it working before premature optimisations.
I know some people have had problems with obstacles and the navmesh and I was wondering if anyone had any better algorithms?
Daniel