Escape By Any Means Devlog pt7


This is the AI movement code.

The AI movement uses Unity Navmesh.

The AI picks a random point within a distance of itself on the map to move to. (it won't move to the other side of the map).

This is done by getting a random unit inside sphere multiplied by a distance. The transform.position is then added and Navmesh sample position is used to get the NavMeshHit position.

When the AI reaches its destination it will stop for 3 seconds then pick a new spot to move to.

Checks are done to stop it from moving to positions that are covered by objects in the scene. This is done by using overlapsphere.

Get Escape By Any Means