Click to move navigation. Log #4 (Unity)

         Altos will be click to move game. Luckily, Unity already has this system implemented, so I will use it. It's called NavMesh and NavMesh Agent. The NavMesh bake mesh over static objects in the scene. This mesh is used by NavMeshAgent to move. All objects marked as static will be considered as inaccessible areas (not exactly obstacles) and the mesh won't be generated in those areas. Another option is to use off-mesh links for jumping between hight levels (floors). I am not going to use it in my game.

So, how to do it? I simply add the Navigation panel (Windows>Navigation) and there is settings under the button Bake. 




Agent Radius defines how close the agent center can get to a wall or a ledge.

Agent Height defines how low the spaces are that the agent can reach.

Max Slope defines how steep the ramps are that the agent walk up.

Step Height defines how high obstructions are that the agent can step on.

OffMeshLink component allows you to incorporate navigation shortcuts which cannot be represented using a walkable surface. For example, jumping over a ditch or a fence, or opening a door before walking through it, can all be described as Off-mesh links.[1]

On the selected object, in panel Object I check Navigation Static and dwon, under the button Bake, is another button Bake, which creates navigation mesh.

         Of course, this is not enough, for the movement we also need something, that will cooperate with navigation mesh. This "something" is component called NavMeshAgent. With my player character selected, in the Inspector I click on the AddComponent button then select Navigation>NavMeshAgent. In the game view is the NavMeshAgent represented by a cylinder. It's needed to by set to fit my player character.


nav mesh agent


Radius is radius of the agent, used to calculate collisions between obstacles and other agents.

Height is the height clearance the agent needs to pass below an obstacle overhead.

Base offset is offset of the collision cylinder in relation to the transform pivot point.

Speed is maximum movement speed (in world units per second).

Angular Speed is maximum speed of rotation (degrees per second).

Acceleration is maximum acceleration (in world units per second squared).

Stopping distance is the agent will stop when this close to the goal location.

Auto Braking When enabled, the agent will slow down when reaching the destination. It should be disabled this for behaviors such patrolling, where the agent should move smoothly between multiple points.[2]

I dont mess with other options usually.




Another log I will go in for player movement.