The Complete Guide to Blender Graphics
NavMesh

NavMesh (Navigation Mesh) creates a path for an object to follow when seeking a target in the “Blender Game Engine”. The path is automatically constructed on a surface.


To demonstrate we will have the a “Sphere” object in the 3D window traverse a simple maze constructed on a “Plane”. The “Sphere” will seek a “Cube” target object.


In the 3D window add a “Plane” and scale up. In “Edit” mode, subdivide then in “Face Select” mode, select faces and extrude upwards forming the maze shown in the diagram. Place the maze in “Object” mode.


















Scale the “Cube” down by 0.50 and park it in the position shown. Add a “UV Sphere” object, scale down 0.50 and park it on the opposite side of the maze.





Make sure you are in “Blender Game” mode.


Add “Material Color” to the objects as shown.


Select the sphere. Change the “Timeline” window to the “Logic Editor” window and enter the logic blocks as shown in the diagram. In the “Steering Actuator” logic block, change the “Behavior” to “Path Following” and set the “Target Object” to “Cube”. We will enter the “Navigation Mesh” parameter after the path has been generated.













Every object in the “Game Engine” requires “Physics” to be applied. When in “Blender Game” mode “Game Physics” is automatically set. By default everything is set to “Physics Type: Static”. Select the sphere and change the “Physics Type” to “Dynamic”. Note that the “Actor” button is automatically checked. The cube and the plane remain “Static”.


With the “Sphere” selected, in the “Properties” window, “Physics” buttons, “Physics” tab, reduce the “Attributes: Radius to 0.500 (Makes the collision bounds spherical volume the same as the diameter of the sphere).


Select the maze (Plane). In the “Properties” window, “Scene” buttons, “Navigation mesh” tab, click on “Build navigation mesh”. You will immediately see a multi colored pattern displayed on the surface of the plane. Note we are using all default values in the “Navigation mesh” tab.





















The colored pattern is a “Navigation Path” (NavMesh) which is a new mesh superimposed on the plane. It may be selected and deselected like any other mesh object. In “Edit” mode you can modify its shape by selecting vertices, edges or faces. For the time being leave the shape as generated.

With the “NavMesh” generated go back to the “Logic Block” entries for the sphere and in the “Steering Actuator” enter “navmesh” in the Navigation Mesh panel.


With the mouse cursor in the 3D window press P for play and see the sphere traverse the maze and find the cube.


Home Book Content Supplements The Author