Problem:
Some agents get stuck on mesh and it makes ClampToNavmeshInternalFull null error every frame.
so, they have a path to the target, but can’t move to next node since it fails on that function.
What I found:
I tried to dig down the call stack, and I found the ‘nextPosition’ value is Vector3(NaN, NaN, NaN)
but I couldn’t find where the value is set…
My Settings:
I am using Recast graph, and enemy has RichAI + RVOController (no funnel modifier, simple funnel thing…)
I am using NodeLink2 for climbing up and down. (But I think this is not the problem.)
Any thoughts about this problem?
+) I modified RichAI.ClampToNavmesh to remove the error… but I know this is just bypass temporally.
protected override Vector3 ClampToNavmesh (Vector3 position, out bool positionChanged)
{
//if (richPath != null) {
// var funnel = richPath.GetCurrentPart() as RichFunnel;
// if (funnel != null) {
// var clampedPosition = funnel.ClampToNavmesh(position);
// // We cannot simply check for equality because some precision may be lost
// // if any coordinate transformations are used.
// if ((clampedPosition - position).sqrMagnitude > 0.001f*0.001f) {
// // The agent was outside the navmesh. Remove that component of the velocity
// // so that the velocity only goes along the direction of the wall, not into it
// var difference = movementPlane.ToPlane(clampedPosition - position);
// velocity2D -= difference * Vector2.Dot(difference, velocity2D) / difference.sqrMagnitude;
// // Make sure the RVO system knows that there was a collision here
// // Otherwise other agents may think this agent continued
// // to move forwards and avoidance quality may suffer
// if (rvoController != null && rvoController.enabled) {
// rvoController.SetCollisionNormal(difference);
// }
// positionChanged = true;
// return clampedPosition;
// }
// }
//}
positionChanged = false;
return position;
}