Tutorial #3


Short one today. I decided to use the tutorial provided scene rather than my own terrain and probuilder for the sake of things just working and totally not because I didn’t have my own coming into the tutorial. This meant that the NavMesh was easy to generate, and worked a treat without any settings tweaks. After setting up the NavMesh and playing around with the raycast click-to-move NavMesh Agent (the NavMesh Agent sounds like a spy movie or something…) I encountered some issues with creating an obstacle according to the tutorial. Turns out the tutorial was showing an out of date version of Unity, where the Navigation window would have tabs for Objects and Baking however newer versions of Unity moved the Baking to the NavMesh and Object settings are just… scattered around I guess? I got around this using the ‘Carve’ setting in the NavMesh obstacle objects, which has the doubled effect of changing the NavMesh as it moves - helpful for later on.

After that it was time for the AI to follow the player. I was going to write an algorithm that predicts the player’s movement based on the player’s movement vector, however I had to get ready to go to my next class by that time. This then meant I used literally “one line” of code for moving the AI bots to the player.

agent.SetDestination(target.transform.position);

Magic.

Then to animate the characters I might have lifted a script from the Unity docs and modified it a little bit to fit my needs.

Not much else to talk about.

Get utas kit207 portfolio

Leave a comment

Log in with itch.io to leave a comment.