[This is preliminary documentation and is subject to change.]

Attempts to optimize the path using a local area search. (Partial replanning.)

Namespace: org.critterai.nav
Assembly: cai-nav (in cai-nav.dll) Version: (


 C#  Visual Basic  Visual C++ 
public void OptimizePathTopology(
	bool updateCorners
Public Sub OptimizePathTopology ( _
	updateCorners As Boolean _
void OptimizePathTopology(
	bool updateCorners


True if the corners data should be refreshed.


Improves pathfinding appearance in crowded areas and for complex meshes.

The only time updateCorners should be set to false is if a move or another optimization method is to be called next. Otherwise the corner data may become invalid.

Inaccurate locomotion or dynamic obstacle avoidance can force the client position significantly outside the original corridor. Over time this can result in the formation of a non-optimal corridor. This method will use a local area path search to try to re-optimize the corridor.

The more inaccurate the client movement, the more beneficial this method becomes. Simply adjust the frequency of the call to match the needs to the client.

This is a local optimization. It usually doesn't effect the entire corridor through to the goal. It should normally be called based on a time increment rather than movement events. I.e. Call once a second.

See Also