Closed AqlaSolutions closed 8 years ago
hmmm sounds like it might be a serialization problem. A value of 0 is what PolyId.Null is defined as, so it could also just be an indexing error or something like that. If you've got a relevant stack trace it may help me pinpoint the issue.
I sent you snb file.
navMeshQuery = new NavMeshQuery(_new NavMeshJsonSerializer().Deserialize(map.NavMeshFile), 2048);
var startPos = new SVector3();
var extents = new SVector3(15f, 25f, 15f);
p = navMeshQuery.FindNearestPoly(startPos, extents);
This just returns PolyId.Null.
Any news?
Sorry, spent the whole day yesterday flying. Loading up the mesh really quickly shows that poly 0 isn't drawing... Looking into it further now.
@AqlaSolutions I just commited a potential fix. Looks like somewhere along the lines of me cleaning up TiledNavMesh I changed the default tile salt to 0 instead of 1. This would mean that instead of a PolyId at (salt, tile, poly) of (1, 0, 0) it was (0, 0, 0), which is what PolyId.Null is defined as.
I also fixed how references get handled in serialization to use the existing PolyId. This breaks compatibility with the existing .snj format, so you'll need to regenerate with the newest version. There's a version check now that will throw an ArgumentException if you don't.
I'll also release 1.0.0-alpha.3 this week so you can just pull down the latest version from NuGet.
Let me know if this actually fixes the issue.
Now fixed, thanks!
So I want to find random point around (0;0;0). And FindRandomPointAroundCircle throws exception when PolyId from FindNearestPoly is passed there.
But it seems like PolyId.Null is considered a valid return from FindNearestPoly for (0; 0; 0).
While debugging FindNearestPoly I noticed that QueryPolygons returns like 52 polys and one of them was that PolyId.Null poly (which I pass later to the FindRandomPointAroundCircle).
I load the navmesh from json so it could be serialization problem.