Forum rules - please read before posting.

Pre-calculate Polygon Collider 2D NavMesh with Holes

Hello. When using a Polygon Collider 2D NavMesh with holes, is the finalized collider being calculated at the time the scene is loaded?

In the case I am tackling, the NavMesh is a very simple rectangular Polygon Collider 2D, but it has many holes within. This results in slow scene loading. Would it be possible to make a "pre-calculated" final collider and save it to some sort of text etc., so it doesn't have to re-calculate the NavMesh with holes every time the scene runs?

Comments

  • By the way, can I use normal collider2D functions with the finalized collider with holes? Such as OverlapPoint?

  • Would it be possible to make a "pre-calculated" final collider and save it to some sort of text etc

    Good suggestion - though I don't know how feasible that would be. I'll do some investigation.

    can I use normal collider2D functions with the finalized collider with holes? Such as OverlapPoint?

    That's a question for Unity, I'm afraid.

  • Yay, I did it by copying the Polygon Collider 2D component, then paste the values on a new NavMesh with no hole.

  • edited December 2018

    Oh no, it is not a good idea as it seems, pathfinding ignore the holes if I just copy and paste the NavMesh values.

    can I use normal collider2D functions with the finalized collider with holes? Such as OverlapPoint?
    I successfully used that.

  • If I use the pasted values on the NavMesh instead of generate the holes on start, the pathfinding just go straight through the holes. Would solving this be easier than making a "pre-calculated" collider?

  • I shall look into it after Christmas for you.

  • Thanks Chris. Merry Christmas~

  • Hi Chris, any idea on this? In some scene the loading time becomes long because of the large number of NavMesh holes. It would be great if a "pre-calculated" navmesh can be used, if it is actually possible that is...

  • As this thread is over a year old, I don't recall exactly my findings - but certainly I would have implemented it had I deemed it viable at the time.

    Can you share details about the actual NavMesh in question? Let's see screens of it's shape, and the NavMesh Inspector.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.
Do NOT follow this link or you will be banned from the site!