Mesh Collider pathfinding

Note: This pathfinding method is not valid for "Unity 2D" mode (see here for the various 2D modes available). Unity 2D mode requires Polygon Collider pathfinding.

The Mesh Collider pathfinding method involves creating a custom 3D mesh (in a separate modelling tool) to mark out the area your Characters can walk. The advantage is that it can be replaced mid-game for another mesh, allowing for dynamic pathfinding without the need for expensive calculations.

To create a custom 3D mesh, you will need to model one in a separate modelling package, such as Blender or Maya. Looking at it top-down, it should follow the shape of the floor you wish to let Characters walk. A NavMesh for the 2D Demo's Park scene may look like this:

This is available to download here. With a custom mesh ready, choose Mesh Collider from the "Scene settings" field in the Scene Manager.

Then click NavMesh in the Scene Manager's Scene prefabs panel. By default it will just appear as an empty object in the centre of your scene. Expand the Mesh Collider component in it's Inspector to find it's Mesh field:

Navigate in your project view to find your custom mesh. It may be displayed as a child object of your mesh asset file:

Drag this mesh into the component's Mesh field, and it will become outlined in green in your Scene view. You may need to adjust your NavMesh object's Transform settings to make it properly fit.

Adventure Creator can "swap out" different NavMesh objects at runtime, so it needs to be told which one is the default. Assign this one as such by dragging the NavMesh GameObject into your Scene Manager's Default NavMesh field.

Your Mesh Collider will now be used by Characters to navigate the scene.

Adventure Creator and this website are copyright Chris Burton, ICEBOX Studios

Go to top
Do NOT follow this link or you will be banned from the site!