public void CalculatePath(Vector3 from, Vector3 to, List <Vector3> result) { if (RecastInterface.FindPath(this.MapId, from, to)) { RecastInterface.Smooth(this.MapId, 2f, 0.5f); { int smoothCount = 0; float[] smooths = RecastInterface.GetPathSmooth(this.MapId, out smoothCount); for (int i = 0; i < smoothCount; ++i) { Vector3 node = new Vector3(smooths[i * 3], smooths[i * 3 + 1], smooths[i * 3 + 2]); result.Add(node); } } } }
public void CalculatePath(RecastPath recastPath) { if (RecastInterface.FindPath(this.MapId, recastPath.StartPos, recastPath.EndPos)) { RecastInterface.Smooth(this.MapId, 2f, 0.5f); { int smoothCount = 0; float[] smooths = RecastInterface.GetPathSmooth(this.MapId, out smoothCount); for (int i = 0; i < smoothCount; ++i) { Vector3 node = new Vector3(smooths[i * 3], smooths[i * 3 + 1], smooths[i * 3 + 2]); recastPath.Results.Add(node); } } } }