Closed AqlaSolutions closed 8 years ago
I sent snb to robert.rouhani@gmail.com
I'll take a look at this right now. Also on a side note, .snb
is supposed to denote the binary file format (which has yet to be implemented), the file format you sent me is .snj
, representing the JSON format. You can verify this by opening up the file you sent me with a text editor and see that it is both in JSON format and under meta.version, see that "snj" is defined as the version of the file format.
Ok. I also emailed you a demo project. So any news?
Not yet, been a really busy few weeks, I'm about a week away from being done with my last semester in college, lots of final projects and assignments coming to a head. #61 should have been fixed pending you testing it.
When I get a chance I'll move this into NavMeshQuery and update it to use the new Path
class.
Ok, then I'll wait a week before testing #61 in case you have anything on this more frequent issue (I need to merge-rebuild-deploy things on our side to test the changes).
I updated the code to your latest version and it now throws ArgumentOutOfRangeException ( Index was out of range. Must be non-negative and less than the size of the collection.) in List.set_Item
on line path[req + i] = path[orig + i];
:
private int FixupCorridor(SharpNav.Pathfinding.Path path, int maxPath, List<NavPolyId> visited)
{
int furthestPath = -1;
int furthestVisited = -1;
//find furhtest common polygon
for (int i = path.Count - 1; i >= 0; i--)
{
bool found = false;
for (int j = visited.Count - 1; j >= 0; j--)
{
if (path[i] == visited[j])
{
furthestPath = i;
furthestVisited = j;
found = true;
}
}
if (found)
break;
}
//if no intersection found, return current path
if (furthestPath == -1 || furthestVisited == -1)
return path.Count;
//concatenate paths
//adjust beginning of the buffer to include the visited
int req = visited.Count - furthestVisited;
int orig = Math.Min(furthestPath + 1, path.Count);
int size = Math.Max(0, path.Count - orig);
if (req + size > maxPath)
size = maxPath - req;
for (int i = 0; i < size; i++)
path[req + i] = path[orig + i]; // *** THROWS HERE ***
//store visited
for (int i = 0; i < req; i++)
path[i] = visited[(visited.Count - 1) - i];
return req + size;
}
Positions on snb that I emailed you before:
From = (X:2.041 Y:3.622 Z:-7.757) To = (X:6.029624 Y:0.6990567 Z:-2.627516)
X is inverted here. In your code it should be X:-2.041 and X:-6.029624.
Here is a screenshot of variables in Locals (but for other random input points): http://screencast.com/t/xnyCCq4Gb
I understand most of the problem but can't reproduce since the JSON file format has changed since you last emailed me the mesh. Could you regenerate the mesh and email it to me again? I'm going to move this function into the Path class and make it use List operations instead of the directly ported array/buffer stuff.
It may work with the changes I'm making before I even get to reproduce the exception on your map.
@Robmaister, Ok, I'm going to check it now and email you a new repro if still applicable.
Fixed!
Great, the solution is less performant than the original, so having a reproducible example will still help in that regard
@Robmaister, ok, I've sent you the repro.
I copied your pathfinding code from the example app and sometimes it throws
IndexOutOfRangeException: Index was outside the bounds of the array
in FixupCorridor. I don't have a specific line, unfortunately. I will email you an snb and coordinates.Here is the method:
Related to #52