I’m working on a 2D game and need to define collision shapes using a Polygon Collider. I already have the collider shapes defined for each sprite, so I’d like to reuse them rather than recreate everything from scratch.
In my game, I have a mining node (a GameObject with a Sprite). When the node is mined, it gets removed from the game. The issue I’m running into is that the collision shape is defined by a polygon, which makes handling Cuting the navmesh process more complicated.
You can pass a custom mesh to the NavmeshCut, though.
In any case, you would not want to use the exact same shape, as you’d want the NavmeshCut shape to be expanded outwards by the agent radius.
Is it possible for you to not use navmesh cutting, and just update the graph normally instead? E.g. by attaching a DynamicObstacle component to your GameObject, and making sure the collider is included in the recast graph scan settings.
I’ll try what you suggested. Additionally, I found a bug where Sphere doesn’t work with a 2D navmesh, it doesn’t cut the mesh at all. I’ve attached a video below showing the issue.
Just took a look and yeah, even going back to 3D mid-runtime it works fine but not in 2D. This issue probably would’ve been better in a new thread but no problem I’ll tag Aron on this to get his feedback.