MengeCrowdSim / Menge

The source code for the Menge crowd simulation framework
Apache License 2.0
139 stars 63 forks source link

Nav mesh obstacle failure -- obstacles selected from wrong level #6

Closed curds01 closed 8 years ago

curds01 commented 8 years ago

When using a navigation mesh-based spatial query object, when there is a navigation mesh polygon over an agent, the obstacles selected for that agent are the covering polygon and not the polygon the agent is actually on.

In the attached example (images shown below), the agent is walking down a ramp and about to cross under an overhang. As soon as the agent center crosses into the projection of the upper polygon, its obstacles will come from that polygon and the agent will not be able reach its goal because the upper polygon has an obstacle between the agent and its goal.

The project for evaluating this can be found below.

image Fig 1. Agent walking down a ramp, underneath an overhang.

image Fig 2. Agent about to pass under the overhang.

nav_mesh_fail.txt nav_mesh_failB.txt nav_mesh_failS.txt nav_mesh_failV.txt simple_NM.txt

curds01 commented 8 years ago

The interface receives a pointer to a ProximityFilter. Generally, the pointer is asked for its query point and that query point is used to look up the node corresponding to the point. This is why the wrong node (aka polygon) is used, because this point is determined in a top-down manner.

However, if we recognize the types of classes that are tracked by the NavMeshLocalizer, we can see if the filter object is one of those objects. If it is, we can simply use that object to look up the correct node in the localizer. Currently, there is only one tracked class: BaseAgent. That is enough for now. If we end up tracking other entities, they will have to be added to this test.

MengeCrowdSim commented 8 years ago

Solution Merged