In this class we were taught how to use the NavMesh in order make AI Agents that would follow a set pattern, in this example the agents would move towards whatever you set as a target. We were also taught a bunch of options that we could fiddle with and change in order to acquire the results we wanted, such as changing the height of a slope or step that they could traverse and jump over.

The script for the player, it allowed the player object to move towards the area you clicked with the mouse.

The script to make the enemies move towards the player.

Through the use of RayCaster we made it so that the player character would move to where you clicked, in the videos at the bottom of this page you can see that in use as with the NavMesh. I set the stopping distance of the enemies to 1 so that I could test out if the point and click feature would work without being crowded by enemies.
Above you can see the interface used in order to set the NavMesh to your liking and to get it to work. After getting it open you then have to select a surface you want the agents to move on and then click "Bake". This will then put a strange looking grid that shows the areas that the agents will be able to move in, you can play around with it to your liking but for the sake of keeping things working I refrained from doing that.
Above are videos showing my work using the NavMesh.

You may also like

Back to Top