Funnel Path Goes Through Non-Walkable (2D)

I set up the grid graph, rotate the axis, applied the 2d physics, and selected the collision layer to make sure all the wall were non walkable.

However I need to use a Funnel modifier, as the default paths are too jerky, and the enemies speedis totally erratic. Funnel sorts this out perfectly, But when I try to make the enemy navigate a complicated path, the path generated is terrible.

See Images: (grid graph setting viewable if you click on the attached image below.)


I need to find a way to make funnel create better paths in the grid graph, and I’m hoping someone out there can help me and point me in the right direction.

Hope you can help.

Hi

The funnel modifier at the moment assumes the path is laid out in XZ space, so in XY space it might not generate the correct path. Sorry about that, it is something I have on my todo list.

You can try using the Simple Smooth Modifier or the Raycast modifier instead.

Here is an extreme of the behaviour. Showing that the funnel really isn’t working properly at all. I really hope I’m missing something simple.

Thanks for the quick reply Aaron. One Followup, as I believe the raycast modifier may be exactly what I need.

However when apply it the raycast modifier seems to ignore all non walkable terrain. just creating straight lines.

Is there’s a setting within Im ignoring that will allow it to work on the XY plane and pay attention to all the non-walkable terrain?

Hi

The raycast modifier will work on the XY plane, however it might not work for your specific case if you are using 2D physics. It currently only works with 3D Physics. Fortunately, it should be really easy to change. Basically you need to open up the script and change all calls to Physics.* to Physics2D.* and maybe change some parameters.

Or you can enable graph raycasting, that will perform raycasts against the graph instead of against the world colliders. That is a pro only feature though.

thanks Aaron. Ill test out your suggestions tomorrow. You are brilliant.

As soon as I can afford pro, I will buy it within the blink of an eye.

Hi Aron,

Hope the 2D enrichment roadmap is getting on track and we can enjoy more 2D functionality in the near future.

I created a RaycastModifier2D following your suggestions above and it works sort of.
It cuts corners too close and when it goes too far of coarse it 'can’t convert VectorPath to StrictVectorPath) which happens in modifiers.cs.

Any idea ?

Yeah, I am planning to add more 2D functionality soon.

Try reordering the modifier priorities on the Seeker component. That happens because the modifiers are not ordered correctly.