Hello Guys,
I now have completed the Building of Navmeshes, however the walking does not work very fine.
Code:
UInt32 startref = q.FindNearestPolygon(Start.ToRecast().ToFloatArray(), new MyVector3(1.5f, 1.5f, 1.5f).ToFloatArray(), f);
if (startref == 0)
{
Log.Output(rtbMain, "ERROR: FindNearestPolygon() failed for Startref. Position was: {0}", Start);
Application.DoEvents();
return;
}
UInt32 endRef = q.FindNearestPolygon(Temp.ToRecast().ToFloatArray(), new MyVector3(1.5f, 1.5f, 1.5f).ToFloatArray(), f);
if (endRef == 0)
{
Log.Output(rtbMain, "ERROR: FindNearestPolygon() failed for Endref. Position was: {0}", Temp);
Application.DoEvents();
return;
}
status = q.FindPath(startref, endRef, Program.objectManager.CurrentPlayer.Location.ToFloatArray(), Temp.ToFloatArray(), f, out hops);
if (status == DetourLayer.DetourStatus.Failure || hops == null)
{
Log.Output(rtbMain, "FindPath failed, start: " + startref + " end: " + endRef);
Application.DoEvents();
return;
}
if (status.HasFlag(DetourLayer.DetourStatus.PartialResult))
{
Log.Output(rtbMain, "Warning, partial result: " + status);
Application.DoEvents();
}
float[] finalPath;
DetourLayer.StraightPathFlag[] pathFlags;
uint[] pathRefs;
status = q.FindStraightPath(Start.ToRecast().ToFloatArray(), Temp.ToRecast().ToFloatArray(), hops, out finalPath, out pathFlags, out pathRefs);
if (status.HasFlag(DetourLayer.DetourStatus.Failure) || (finalPath == null || pathFlags == null || pathRefs == null))
Log.Output(rtbMain, "FindStraightPath failed, refs in corridor: " + hops.Length);
I tried to trace that error back and ended up with this:

Sorry for the bad video quality :/