I started using A* Pathfinding for a RTS mobile game, and I’m testing all kind of stuff. I had a hard time getting the Navmesh Graph to work with the native 2D features of Unity, so I changed to the Grid Graph.
I’m using two Box Collider 2D as obstacles, marked with the Obstacles layer.
I’m giving orders to a group of tank to move across the obstacles. Without the funnel, it works fine. (I highlighted the path for better visibility)
But if I assign a funnel modifier to the tank amongst the seeker, here is what I have.
Oh wait. You were using 2D.
Ah. That explains it. The funnel modifier is currently written for the XZ plane only, not the XY plane. I am doing a rewrite where this will be solved, but currently the funnel modifier does not work properly in the XY plane.
The funnel modifier needs to project the path down onto a single plane to be able to find the shortest path inside it. Currently it projects it down to the XZ plane. If it works in the XY plane will most likely boil down to floating point imprecision. You can try using the raycast simplifier instead.
Make sure you use graph raycasting with the raycast modifier since just raycasting will use 3D physics, not 2D physics (really should fix that as well).
Seconded! I attempted to try to update the funnel modifier to work in 2d… and well, it was a mess. I’m just not knowledgable enough to understand what needs changing beyond the .z and .y flips.