Almost :)
There are many ways to handle blocked polygons. Here's one.
The polygon flag filter works so that you can specify certain flags,
which must be on (included), and certain flags which must not be on
(excluded) for a polygon to be valid. In code the filter looks like
this:
inline bool passFilter(const dtQueryFilter* filter, unsigned short flags)
{
return (flags & filter->includeFlags) != 0 && (flags &
filter->excludeFlags) == 0;
}
You could for example have following default filter for "humans":
flt.includeFlags = SURFACE_GROUND | SURFACE_SHALLOW_WATER | SURFACE_DOOR;
flt.excludeFlags = SURFACE_DISABLED;
It means that it will accept polygons which are either ground, shallow
water or door, but not disabled.
Then it is matter of setting or clearing the SURFACE_DISABLED flag for
the polys which are disabled (i.e. locked door).
You can change the flags of a polygon using dtNavMesh.getPolyFlags()
and dtNavMesh.setPolyFlags().
Take care if multiple sources can change the same polygon flags.
Remember that a door area can be potentially composed of many
polygons. One way to handle this is to query the necessary polygons
using dtNavMesh. findPolysAround() at the door center location (and
approx radius) with following filter:
flt.includeFlags = SURFACE_DOOR;
flt.excludeFlags = 0; // will return both enabled and disabled polys
This will only expand to polygons which are have door "ability". Then
on your door logic you can change their flags based on the door state.
Area type is meant to specify how expensive the polygon is to travel,
but you can misuse it in certain cases to do secondary manual
filtering yourself.
--mikko