Tutorial Week 3
This week, the task in our tutorial is to try out Unity's Nav Mesh system so that it can help the characters where the path is and where the obstacle is. It is quite similar to the A* algorithm in 2D, so it is very useful in leveling design, one of the most basic things of a game developer. Since I don't know if my scene was able to use the Nav Mesh ( it's quite simple ) so I will do this tutorial in the provided scene from the Unit Content.
I started this week's tutorial with my first mini quest, creating an AI character with every click in the game at that very point. To do this I used Unity's Instantiate function, which creates a clone of a prefab at a certain point (see more here: https://docs.unity3d.com/ScriptReference/Object.Instantiate.html). The use of this Instantiate function is quite familiar to me so it didn't take me too long to get it done. Here is a gif of this:
After that, our second task is making the newly created AI follow and predict the position of Player ( green body ) if he's moving to the next point. I've found that this can be done simply by having these AIs move to the next location the player is going to. To determine this position, I multiply the player's speed and movement vector (which can be easily obtained from the Nav Mesh Agent) then add the current position to get the position that the player will move to. Therefore, the only think I have to do is set the path to this position for the AI if their positions are different with the player's position. Below is a gif showing how it works:
You can easily see the mouse clicks in the clip, that's what i use to move the player, and it's like the AIs will also move to that point because that point will be the calculated point based on the formula that I have mentioned above. It doesn't look like the AIs are chasing Player too much because the AIs are not following the player, they are going to the point that player will go ( I don't cheat by taking click points and making them move there ). Overall our tutorial this week seems not too hard and it can easily done by writing some basic script. However it still brings me some things news like Nav Mesh so I would practicing it more in my simple game in the next Self-Study
KIT207 Portfolio
Status | Released |
Author | Vu Kim Phong |
Genre | Action |
More posts
- Tutorial Week 5Aug 24, 2021
- Self-Study Module 5Aug 16, 2021
- Game IdeasAug 09, 2021
- Self-Study Module 4Aug 08, 2021
- Self-Study Module 3Aug 03, 2021
- Tutorial Week 2Aug 02, 2021
- Self-Study Module 2Jul 27, 2021
- Tutorial Week 1Jul 26, 2021
- Self-Study Module 1Jul 14, 2021
Leave a comment
Log in with itch.io to leave a comment.