In cases when objects are not present on the scene (e.g. generated exterior
cells) navmesh is not updated because area that suppose to be covered with it
was not updated. It was updated only during cell change. This is a regression
from d15e1dca84.
Set TileCachedRecastMeshManager range on NavMeshManager update to make sure it
always covers correct area around player.
Return a union of objects, heightfields and water ranges from
getLimitedObjectsRange intersected with range provided above.
Object AABB may be much larger than area currently covered by navmesh. In this
case all tiles beyond covered range should be ignored. Attempt to iterate over
them will not result in any new tile updates but can take quite a while. At
maximum this can be pow(INT_MAX - INT_MIN, 2) iterations.
Use arbitrary time limit to check for update call to finish in the test.
If object is too big iteration over all tiles covering it can take too much
time. Limit bounds to a square around a player position to cover only tiles
that will be present in navmesh based on max tiles number option.
Each object is associated with a set of tiles its present in. Culling can
reduce this set but it has to be update when bounds change position. Do this
in TileCachedRecastMeshManager::setBounds updating the set and adding/removing
objects to the corresponding CachedRecastMeshManagers.
If object is too big iteration over all tiles covering it can take too much
time. Limit bounds to a square around a player position to cover only tiles
that will be present in navmesh based on max tiles number option.
OscillatingRecastMeshObject::update should be called with tile bounds in real
coordinates not in navmesh. But proper scaling was done only in
RecastMeshManager::getMesh and RecastMeshManager::updateObject used tile bounds
in navmesh coordinates.
Add a new function to create tile bounds with proper scaling and pass correct
value into RecastMeshManager constructor through CachedRecastMeshManager
constuctor from TileCachedRecastMeshManager member functions.
To avoid triggering NavMesh update when RecastMesh change should not change
NavMesh.
Based on the following assumption:
Given a set of transformations and a bounding shape for all these
tranformations, a new object transformation that does not change this
bounding shape also should not change navmesh if for all of this object
transformations resulting navmesh tiles are equivalent
The idea is to report back to RecastMeshManager all changes of NavMesh if there
are any assiciated with RecastMesh version. So we know the last time when
RecastMesh change resulted into the NavMesh change. When later report shows
that there was no NavMesh change for a new RecastMesh version we can assume
that any object transformation within the same bounding box should not change
NavMesh.
When update method is called for not changed object befor this change
all object tiles were considered as not object tiles and were removed.
Also this marked those tiles as changed. This lead to alternation
between remove and add each tile update method was called. Problem was
detected by using Animated Containers mod.
Every updated object should produce a set of changed tiles where it is
placed. Before this change only current object tiles were updated. If
object was moved to another set of tiles then navmesh were not changed
in new tiles.
TileCachedRecastMeshManager::updateObject should add all new tiles if object
was moved and remove all no more used tiles. Both new and old tiles should be
marked as changed.
Also add tests to show desired result for add, update, remove.