NavMeshCut for custom navmeshes

Hi

Quick question: The requirement of TileHandlerHelper suggests NavMeshCut only works for RecastGraph Navmeshes - is that correct? It doesn’t seems to be working with generated meshes…

Thanks

Rob

Hi

Yes, that is correct.
It is actually possible to load custom meshes into recast graphs, but at the moment it is a bit tricky, and very undocumented.

It is possible using the TileHandler class. You can check the TileHandlerHelper code to see how it is loading tiles into the recast graph. What you can do is to create a recast graph which only has a single tile, then load your mesh in as that tile using a TileHandler.

Hi,

Thank you for your reply ! I’ve spent the afternoon trying this, with not a huge amount of success. I’m just creating a new TileType and replacing activeTileTypes/tileTypes.

Within TileHandler, how do I get the recast graph to recognise this new mesh? Also, Is it ok to have have one giant tile? or should I scale it to the bounds of the mesh?

Rob

`
using UnityEngine;
using System.Collections;
using Pathfinding;
using Pathfinding.Util;

public class DynamicNavmesh : MonoBehaviour {

TileHandler handler;
public GameObject navMeshToUse;
Mesh thenavMesh;
TileHandler.TileType thisTile;

void Start () {

    handler = new TileHandler(AstarPath.active.astarData.recastGraph);
    handler.CreateTileTypesFromGraph();

    thenavMesh = navMeshToUse.GetComponent<MeshFilter>().mesh;

    Int3 size = new Int3(100,10,100);
    thisTile =  new TileHandler.TileType(thenavMesh, size, new Int3(0, 0, 0), 100, 100);

    handler.activeTileTypes[0] = thisTile;
    handler.tileTypes[0] = thisTile;
}

}
`

Hi

I have not tested, but something like this should work

handler = new TileHandler(AstarPath.active.astarData.recastGraph); TileHandler.TileType tp = handler.RegisterTileType ( thenavmesh, new Int3(0,0,0) ); handler.LoadTile ( tp, 0, 0, 0, 0);

Make sure that the recast graph is using no tiles (i.e a single large tile internally).
The bounds should completely enclose the size of the mesh.
The mesh should have its centre at (0,0,0).

Ok, so now the mesh loads - awesome :slight_smile:

This method appears to work when using small navmeshes (worth noting: the cutter appears to simplify the mesh a great deal - which could be an issue)

However, a problem arises when dealing with a single large tile (here is an example mesh generated: http://bit.ly/1aV59N6). When I attempt to use the navmesh cutting the tile either disappears or the system crashes.

As you can see from the example, the number of verts is pretty low, so I dont see why I can’t still do navmesh cutting.

Is there are way of manually defining a Rect and a middle point, then updating the navmesh ?

Many thanks

Rob

Apologies to bump this up - but any thoughts on this Aron ?

Many thanks

Rob

I’m also interested in this as would like to combine a custom NavMesh with cutting. If this feature could be worked up, it would be appreciated. Cheers.