Degenerate geometry error since updating

  • A* version: 5.3.4
  • Unity version: 6000.0.41f1

This is a survival open world game. I use FollowerEntity & NavmeshCut’s. The NavmeshCut is used by things you can build in the world. For example, when you place down a floor it has 2 components: A cutter (to cut the terrain navmesh below the floor) then an adder to add to the surface of the floor.

This causes 2 problems:
First, since updating from an older version I now get this error consistently: “Exception: Caught in a potentially infinite loop. The navmesh probably contains degenerate geometry.”

Second, where two floors meet, the AI often spin in a circle for a bit before they’re able to continue moving normally.

Thanks for the help!

Bump:
This is still a problem. I don’t know what degenerate geometry is. Whenever this error is present though, NPCs across the map using FollowerEntity seem to freeze up.

Hi

Do you have a screenshot of your navmesh cut setup?
Have you narrowed it down to a specific navmesh cut that is causing the issue?

Same error.
Version: 5.3.1
Unity: 6000.0.24f1

It happens slowly on each agent, at different times, and they always crash before entering a new node in the navmesh (Recast)
I attach the part of the code that I use to follow the navmesh refresh following the construction of a new building.
The agent continues walking while remaining stationary (I assume he is brought back shortly after).
This problem also happens with navlinks, they are executed, and when they are finished, the agents are teleported to the starting position


    protected virtual void OnBuild() 
    {
        GameSubsystem.instance.BuildsManager.CityStructureCompleted(this);

        AstarPath.active.UpdateGraphs(boundsCollider.bounds);

        if (GameSubsystem.instance.Terrain)
        {
            RemoveGrassInBounds(GameSubsystem.instance.Terrain, boundsCollider.bounds);
        }
        
        UObserver.Broadcast(GLMessageGateway.BUILD_COMPLETED, this);
    }

Error:

Exception: Caught in a potentially infinite loop. The navmesh probably contains degenerate geometry.
Pathfinding.PathTracer.IsInnerVertexTriangleMesh (Pathfinding.Collections.CircularBuffer1[T] nodes, Pathfinding.Funnel+PathPart part, System.Int32 portalIndex, System.Boolean rightSide, System.Collections.Generic.List1[T] alternativeNodes, Pathfinding.NNConstraint nnConstraint, System.Int32& startIndex, System.Int32& endIndex, Pathfinding.ITraversalProvider traversalProvider, Pathfinding.Path path) (at ./Packages/com.arongranberg.astar/Utilities/PathTracer.cs:1286)
Pathfinding.PathTracer.IsInnerVertex (Pathfinding.Collections.CircularBuffer1[T] nodes, Pathfinding.Funnel+PathPart part, System.Int32 portalIndex, System.Boolean rightSide, System.Collections.Generic.List1[T] alternativeNodes, Pathfinding.NNConstraint nnConstraint, System.Int32& startIndex, System.Int32& endIndex, Pathfinding.ITraversalProvider traversalProvider, Pathfinding.Path path) (at ./Packages/com.arongranberg.astar/Utilities/PathTracer.cs:1180)
Pathfinding.PathTracer.FirstInnerVertex (Unity.Collections.NativeArray1[T] indices, System.Int32 numCorners, System.Collections.Generic.List1[T] alternativePath, System.Int32& alternativeStartIndex, System.Int32& alternativeEndIndex, Pathfinding.ITraversalProvider traversalProvider, Pathfinding.Path path) (at ./Packages/com.arongranberg.astar/Utilities/PathTracer.cs:1310)
Pathfinding.PathTracer.GetNextCornerIndices (Unity.Collections.NativeArray1[System.Int32]& buffer, System.Int32 maxCorners, Unity.Collections.Allocator allocator, System.Boolean& lastCorner, Pathfinding.ITraversalProvider traversalProvider, Pathfinding.Path path) (at ./Packages/com.arongranberg.astar/Utilities/PathTracer.cs:1420) Pathfinding.ECS.JobRepairPath.Execute (Unity.Transforms.LocalTransform& transform, Pathfinding.ECS.MovementState& state, Pathfinding.ECS.AgentCylinderShape& shape, Pathfinding.ECS.AgentMovementPlane& movementPlane, Pathfinding.ECS.AutoRepathPolicy& autoRepathPolicy, Pathfinding.ECS.DestinationPoint& destination, Unity.Entities.EnabledRefRW1[T] readyToTraverseOffMeshLink, Pathfinding.ECS.ManagedState managedState, Pathfinding.ECS.MovementSettings& settings, Unity.Collections.NativeList1[T] nextCornersScratch, Unity.Collections.NativeArray1[System.Int32]& indicesScratch, Unity.Collections.Allocator allocator, System.Boolean onlyApplyPendingPaths) (at ./Packages/com.arongranberg.astar/Core/ECS/Jobs/JobRepairPath.cs:188)
Pathfinding.ECS.JobRepairPath.Execute (Unity.Entities.ArchetypeChunk& chunk, System.Int32 unfilteredChunkIndex, System.Boolean useEnabledMask, Unity.Burst.Intrinsics.v128& chunkEnabledMask) (at ./Packages/com.arongranberg.astar/Core/ECS/Jobs/JobRepairPath.cs:127)
Pathfinding.ECS.JobRepairPath.Unity.Entities.IJobChunk.Execute (Unity.Entities.ArchetypeChunk& chunk, System.Int32 unfilteredChunkIndex, System.Boolean useEnabledMask, Unity.Burst.Intrinsics.v128& chunkEnabledMask) <0x214454b2460 + 0x00072> in :0
Unity.Entities.JobChunkExtensions+JobChunkProducer1[T].ExecuteInternal (Unity.Entities.JobChunkExtensions+JobChunkWrapper1[T]& jobWrapper, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at ./Library/PackageCache/com.unity.entities/Unity.Entities/IJobChunk.cs:420)
Unity.Entities.JobChunkExtensions+JobChunkProducer1[T].Execute (Unity.Entities.JobChunkExtensions+JobChunkWrapper1[T]& jobWrapper, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at ./Library/PackageCache/com.unity.entities/Unity.Entities/IJobChunk.cs:363)

I’m trying to switch to a grid pathfinder, recast is giving me a lot of problems

@aron_granberg

Even changing the type of pathfinder didn’t solve the problem, In my game I often change the agent’s movement speed, can this affect it?

Exception: Axis-aligned connection not found
Pathfinding.PathTracer.RemoveGridPathDiagonals (Pathfinding.Funnel+PathPart[] parts, System.Int32 partIndex, Pathfinding.Collections.CircularBuffer`1[Pathfinding.GraphNode]& path, Pathfinding.Collections.CircularBuffer`1[System.Int32]& pathNodeHashes, Pathfinding.NNConstraint nnConstraint, Pathfinding.ITraversalProvider traversalProvider, Pathfinding.Path pathObject) (at ./Packages/com.arongranberg.astar/Utilities/PathTracer.cs:1909)
Pathfinding.PathTracer.SetPath (System.Collections.Generic.List`1[T] parts, System.Collections.Generic.List`1[T] nodes, UnityEngine.Vector3 unclampedStartPoint, UnityEngine.Vector3 unclampedEndPoint, Pathfinding.Util.NativeMovementPlane movementPlane, Pathfinding.PathRequestSettings pathfindingSettings, Pathfinding.Path path) (at ./Packages/com.arongranberg.astar/Utilities/PathTracer.cs:1980)
Pathfinding.PathTracer.SetPath (Pathfinding.ABPath path, Pathfinding.Util.NativeMovementPlane movementPlane) (at ./Packages/com.arongranberg.astar/Utilities/PathTracer.cs:1948)
Pathfinding.ECS.ManagedState.SetPath (Pathfinding.Path path, Pathfinding.ECS.ManagedState state, Pathfinding.ECS.AgentMovementPlane& movementPlane, Pathfinding.ECS.DestinationPoint& destination) (at ./Packages/com.arongranberg.astar/Core/ECS/Components/ManagedState.cs:122)
UnityEngine.Debug:LogException(Exception)
Pathfinding.ECS.ManagedState:SetPath(Path, ManagedState, AgentMovementPlane&, DestinationPoint&) (at ./Packages/com.arongranberg.astar/Core/ECS/Components/ManagedState.cs:132)
Pathfinding.ECS.JobRepairPath:Execute(LocalTransform&, MovementState&, AgentCylinderShape&, AgentMovementPlane&, AutoRepathPolicy&, DestinationPoint&, EnabledRefRW`1, ManagedState, MovementSettings&, NativeList`1, NativeArray`1&, Allocator, Boolean) (at ./Packages/com.arongranberg.astar/Core/ECS/Jobs/JobRepairPath.cs:158)
Pathfinding.ECS.JobRepairPath:Execute(ArchetypeChunk&, Int32, Boolean, v128&) (at ./Packages/com.arongranberg.astar/Core/ECS/Jobs/JobRepairPath.cs:127)
Pathfinding.ECS.JobRepairPath:Unity.Entities.IJobChunk.Execute(ArchetypeChunk&, Int32, Boolean, v128&)
Unity.Entities.JobChunkProducer`1:ExecuteInternal(JobChunkWrapper`1&, IntPtr, JobRanges&, Int32) (at ./Library/PackageCache/com.unity.entities/Unity.Entities/IJobChunk.cs:420)
Unity.Entities.JobChunkProducer`1:Execute(JobChunkWrapper`1&, IntPtr, IntPtr, JobRanges&, Int32) (at ./Library/PackageCache/com.unity.entities/Unity.Entities/IJobChunk.cs:363)

Not that I have a fix but I had to switch from using Recast Graphs to using Layered Grid because of infinite loops with Recast that would cause a crash due to degenerate triangles. You can use the layered grid graph to update which blocks are walkable or not during runtime if you want which is pretty much like a navmeshcut…you can actually see it working in runtime as an object moves just like a recast.

If you scroll to the bottom of Navmesh Cut Component causing IndexOutOfRangeException and Crash - #10 by aron_granberg I have an example of a Method to do so.

You’ll still have to work the Layered Grid though…as it connects grid blocks through objects just because (green circle areas). I believe as a result of your object not being flush/aligned with your grid’s direction axis. So I put in these big grey boxes all over to ensure it doesn’t link areas.

@Marrech_h have you tried updating to the latest version?