(Grid Graph)
Hi,
the callback method OnPathComplete returns a path, where its path.vectorPath contains one node, whose (Vector3) attributes x, y, z = NaN. In this case the units walking to the center of the map (Vector.zero i guess).
Start path here:
public void ResearchPath() {
if (DisableRepath == true || this.TargetPosition == Vector3.zero || myPState == PState.RPF || myPState == PState.PF) {
return;
}
/*
bool whatEver = seeker.IsDone();
if (!whatEver) {
return;
}*/
if ( (Time.time - lastRepath) < RepathRate ) {
return;
}
SetState(PState.RPF);
lastRepath = Time.time;
updateGraphAround(UnitsLayer);
seeker.StartPath (transform.position, this.TargetPosition, OnRepathComplete, GRIDMASK);
}
Calback method, sometimes the ‘Path p’ contains one node, which is invalid.
public void OnRepathComplete (Path p) {
p.Claim(this);
updateGraphAround(ObstacleLayer);
if (!p.error) {
CalculatePathError = false;
//Release the previous path
if (path != null) path.Release (this);
path = p;
SetState(PState.PathFound);
// reset the counter, path found
RPCounter = 0;
return;
} else {
CalculatePathError = true;
ClearPath();
SetState(PState.Idle);
p.Release (this);
return;
}
}
Is this problem known, I use the version 3.4.0.5 (Pro).
Additional information 1:
I moving 10 units at the same time, and if they reach its desired positions, whose are near to each other, then sometimes the wrong path is genated for some units. Maybe they fail somehow to move to its target positions, because it is already blocked by a unit… If the units collide, they search a new path after a while and then the ResearchPath method is called. Strange is that it just happens sometimes, probably i do something wrong with path-Claim and path-Release methods? I need to move the units together 4-5 times and have to try to collide them at destination so oft as possible, to reproduce this.
Additional information 2:
It happens when the seekers Exact End Point has been set to Interpolate. I like how the interpolate option works, but in this version it makes too much trouble. Is the Interpolate on End Point probably fixed in later releases? End Point with Original and Closest On Node works fine. However, i switched back to Original and i hope it will work for my purposes…
Thanks for your answers.