Why is it cutting it so close?

Hi, I just switched from Polynav2D to Astar Pathfinding Project to gain the benefits of multithreading and also not having to add a component to each obstacle. It was very easy to set up the basics.

However, I’m having trouble getting the character to move naturally and not hit corners.

Without modifiers, the AI’s movements are of course very jagged, but even then it still hits the corner. The collider of our character is a capsule collider that you see between her feet and it’s 0.5 units wide.

I’ve tested with Simple Smooth and Funnel and both also hit the colliders of the cliffs. Simple smooth does it way too much, like the docs say, but funnel does what is shown in the image. Is there any setting that I’ve missed? Ideally I want the character to keep a bit of distance to the colliders, but if I increase diameter of the collision testing (It’s currently 1), then the path between these cliffs becomes unwalkable.

After I took these pics, I disabled Cut corners in the Pathfinding component, but it still seem to do this.

Also I’d prefer the movement to be smooth as well, but I’m not sure how to combine all modifiers to get this behavior.

Thank you in advance for guidance!

We’ve been getting some pretty good curve taking by making the grid size smaller, and the collider radius bigger. But now with a map 750x750 nodes, the gizmos are EXTREMELY slow, in playmode it’s 1-2 FPS, and the character gets stuck jumping back and forth, maybe something related to the frame rate.

So what do you recommend for a game like our with lots of uneven colliders? Is grid graph the only option for 2D? Or is there some way to create a navmesh?

Making a 200x200 grid seemed much better while debugging, but that would mean a lot more graphs, and from other threads i see you’re suggesting to use only one.

And with a setting like this, the AI can’t walk through what seems like a perfectly walkable area. I moved with WASD to get there, and the colliders are fine, it’s just the radius that makes it unwalkable. Any ideas? :slight_smile:

image

Hi

Looking at your collider in the first post, the collider looks like it doesn’t match that well to the rocks, especially close to where the character is in that screenshot. I think if you adjusted the collider a bit you would get the path you desired. A recast graph is what I would recommend in this case if it was a 3D game, but the recast graph doesn’t work for 2D physics.
It is possible you can get it to work well if you use a navmesh graph of just a big empty plane, and then add a navmesh cut to every rock, but then you’d need to create meshes to feed to those navmesh cuts so that they cut the correct contour.

What you can do for your grid graph is that you can make the nodes walkable pretty close to the colliders, but you can use the “Erosion Uses Tags” setting to mark the nodes next to the rocks with a specific tag. Then on your Seeker component you can make the agent have a very high penalty for traversing that node. That means the agent will try to avoid walking on the nodes next to the rocks, but will be able to do it if necessary. See GridGraph - A* Pathfinding Project

Hi, thanks, you replied with the Erosion tip in another thread by me, and that worked great. It feels like a waste of resources to have that many nodes in a grid graph, but it’s very convenient.

Do you suggest any upper limit to node counts? We found that 750x750 works quickly, but the gizmos make the game crawl to a mere 1-2 FPS, so it’s not very fun debugging. :slight_smile:

I have heard of games with 1000x1000 nodes, but that’s pretty much the reasonable upper limit.

You might want to try the beta version, the gizmos are a bit faster there. See A* Pathfinding Project

Oh nice, thanks i’ll check it! When are those features planned to go into stable?