Invalid AABB result on NavMeshQuery.MapLocation

I’m messing around with using the Navmesh and NavMeshQuery in DOTS. I have a few entities moving around on the terrain, but at some points (it seems to often happen on steep terrain) the entity’s translation is set to (NaN, NaN, NaN) after the console throws this error:

Console Error

Invalid AABB result
UnityEngine.Experimental.AI.NavMeshQuery:MapLocation (UnityEngine.Vector3,UnityEngine.Vector3,int,int)
Navigation_System/<>c__DisplayClass_OnUpdate_LambdaJob1:OriginalLambdaBody (Navigator_Data&,Unity.Entities.DynamicBuffer`1<NavWaypoints_Buffer>&,Unity.Entities.DynamicBuffer`1<NavStatus_BufferElement>&,Emission_Property&,Unity.Transforms.Translation&,Unity.Entities.Entity&,ObstacleAvoidance_Data&) (at Assets/Scripts/_Systems/Navigation_System.cs:68)
Navigation_System/<>c__DisplayClass_OnUpdate_LambdaJob1:PerformLambda (void*,void*,Unity.Entities.Entity)
Unity.Entities.CodeGeneratedJobForEach.StructuralChangeEntityProvider:IterateEntities (void*,void*,Unity.Entities.CodeGeneratedJobForEach.StructuralChangeEntityProvider/PerformLambdaDelegate) (at Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/CodeGeneratedJobForEach/LambdaParameterValueProviders.cs:352)
Navigation_System/<>c__DisplayClass_OnUpdate_LambdaJob1:Execute (Unity.Entities.ComponentSystemBase,Unity.Entities.EntityQuery)
Navigation_System:OnUpdate () (at Assets/Scripts/_Systems/Navigation_System.cs:53)
Unity.Entities.SystemBase:Update () (at Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/SystemBase.cs:400)
Unity.Entities.ComponentSystemGroup:UpdateAllSystems () (at Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/ComponentSystemGroup.cs:472)
Unity.Entities.ComponentSystemGroup:OnUpdate () (at Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/ComponentSystemGroup.cs:417)
Unity.Entities.ComponentSystem:Update () (at Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/ComponentSystem.cs:114)
Unity.Entities.ScriptBehaviourUpdateOrder/DummyDelegateWrapper:TriggerUpdate () (at Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/ScriptBehaviourUpdateOrder.cs:333)

I have no idea what the Invalid AABB result means in this case and/or how to avoid it, if it’s a bug or if I am doing something wrong.

Here’s a piece of the code that I wrote that is relevent

public class Navigation_System : SystemBase
{
    public Dictionary<Entity, NavMeshQuery> navQueries = new Dictionary<Entity, NavMeshQuery>();

    protected override void OnUpdate()
    {
        Entities.ForEach((ref Navigator_Data nav, ref Translation trans, in Entity entity) =>
        {
            NavMeshLocation location = navQueries[entity].MapLocation(trans.Value, new float3(5, 5, 5), nav.agentID, nav.areaMask); // line 68
            trans.Value = location.position;

        }).WithoutBurst().WithStructuralChanges().Run();
    }
}

It’s also not an exception so I can’t figure out how to debug this. There doesn’t seem to be any useful information on what the error message is.

If someone can help me figure out what this is / means and how to avoid it that would be helpful!

Thanks!

1 Like

I managed to find out that somehow the NavMeshLocation’s position provided by the query was (NaN, NaN, NaN), which in the following frame after setting the translation value would trigger the error.

1 Like