Independent Study: How to navigate the player?-Renyan Jiang
More than often, we will have to limit the players to playable areas, so they can't climb over hills or run through lakes. To do that, we have to adjust the settings in the item called the navigation mesh. In Unity, you can easily find the navigation mesh by clicking the Window, then Navigation. Navigation meshes will show up over a certain part of the terrain, identifying which areas can be walked on, and then AIs can use this information to define how to get around obstacles and navigate from one point to another. And we have to tell the engine what type of objects are we going to be applying this to.
When set the adjustments, we have to first choose the object -- Terrain. Then choose the bake settings. In the settings, we will see the agent radius and height and other few items.
Agent Radius means how wide the unit, such as the player, can travel over this terrain. Similarly, agent height stands for how tall it is, and the max slope means how steep of a slope it can climb. One thing needs to be kept in mind is that in order to make the amount reasonable and have it works properly, we have to set the number according to our biggest unit, such as the radius of the width of your widest unit.
The agent height really only matters if you have things like buildings or structures,where a character might not be able to get low enough to enter somewhere, such as a ventilation shaft.
Remember, after the adjustments we have to hit the bake. And when the system applied the changes, we would tell the difference by locating the blue areas the system marked on the terrain, which determine the places the units can actually walk around.
Gui text would also help to navigate your player. You can either create game object -- Gui text, and apply it to certain asset you've built in your scene as an additional component, or you can add it as an action in your FSM state. Just like that.
For more information, you can access to the online tutorial HERE.
COMMENTS