示例#1
0
        public unsafe bool TryFindPath(NavQuerySettings querySettings, float3 start, float3 end, float3 *path, out int pathLength)
        {
            pathLength = 0;
            if (DtQuery == IntPtr.Zero)
            {
                return(false);
            }

            DtPathFindQuery query;

            query.Source                = start;
            query.Target                = end;
            query.MaxPathPoints         = querySettings.MaxPathPoints;
            query.FindNearestPolyExtent = querySettings.FindNearestPolyExtent;
            DtPathFindResult queryResult;

            queryResult.PathPoints = new IntPtr(path);
            Navigation.Query.FindStraightPath(DtQuery, ref query, new IntPtr(&queryResult));
            if (!queryResult.PathFound)
            {
                return(false);
            }

            pathLength = queryResult.NumPathPoints;
            return(true);
        }
示例#2
0
        public unsafe bool HasPath(NavQuerySettings querySettings, float3 start, float3 end)
        {
            if (DtQuery == IntPtr.Zero)
            {
                return(false);
            }

            DtPathFindQuery query;

            query.Source                = start;
            query.Target                = end;
            query.MaxPathPoints         = querySettings.MaxPathPoints;
            query.FindNearestPolyExtent = querySettings.FindNearestPolyExtent;

            int result = Navigation.Query.HasPath(DtQuery, ref query);

            return(result == 1);
        }