Support Forum

Linecast was stuck in infinite loop v4.3.47b

See this is a legacy error. Getting this consistently on my spherical navmesh.

When I say consistently, FYI

This is having a severe impact on performance. Even with logging turned off, this error comes through, and I can’t possibly optimize or move forward developing with A* while this error keeps coming up. This is on a spherical navmesh.

For now, I’ve commented out the debug, and turned the infinite loop counter down from 2000 to 200. From what I can tell, this is trying to find nodes and if it the detected point is through the mesh, tries another cast. Well, this will happen all the time on a rough spherical planet, with many concave areas.

Hi

Sorry, I know you’ve heard this many times from me now, but linecasts are also one of those things that are not supported on spherical navmeshes. To get those to work the code would need to some more complex vector math to figure everything out. As it is right now the code works on rotated navmeshes, but not on arbitrarily curved surfaces.

That it inf loops is definitely a bug though, it should log an error.

It doesn’t inf loop; you have put a handy overflow counter on it. I am using your AIPath example from the Spherical example scene. Can I just comment out any references to LineCast seeing as it returns true on overload? What exactly does linecast do/optimize/enable?

If AIAlignedToSurface uses LineCast and doesn’t work on spherical navmeshes, it probably should not be assigned to the AI’s in the Spherical example Unity scene, I would think.

So I need to create my own movement script for my mountainous spherical planets, correct?

edit: I’m confused now, looking back through the scripts and seeing LineCast is in navmeshbase, referenced all over the project. This seems like a major refactor to not use Linecast. I’m admittedly not a senior level coder, so can you simplify for me what I am missing by not using Linecast? If it is a fundamental feature of A, should spherical support (and examples) be removed if the project doesn’t support spherical (really)?

Hi

The AIPathAlignedToSurface doesn’t use linecast. Are you sure you haven’t attached a path modifier to the gameObject too? (e.g. the RaycastModifier).

Sorry, yes I’m using funnel modifier per the Spherical example.

Hm. That one doesn’t use linecasts either. It’s possible that you have set some non-default settings in the Seeker → Start End Modifier which could make it use linecasts (setting snapping to Original and then enabling raycasting will do it). Otherwise, check the stack trace for the error message and see where it is coming from.

[EDIT] Actually, I just remembered the funnel modifier does use linecasts if the quality is set to high.

Ok I will try without - that is also copied from the Spherical example btw.