I have the following setup:
- A* as a Grid Graph of 512x512
- Use 2D Physics
- Collision testing - circle, 0.5 diameter
My AI are setup with:
- Seeker - Closest on Node for both
- AI Lerp - Repath rate 0.5, Can search No, Can Move Yes, Enable Rotation No, Interpolate Switches Yes
If I turn on Can Search, in the scene window I can see them patching to (0,0,0) for a split second and then the path switches to my intended target. Its very strange as they constantly try (0,0,0) and switch to the target right away. When I turn off search, this no longer happens. Is this intended?
Now the real problem… I have 3 AI units. After I move the target around several times (its the player walking around,) one of the units gets lost and stops pathing. It is doing something as I can see it moving around. But, the debug green line is no longer visible and the unit behaves very strangely.
I am using the path finding logic from the documentation.
if (Time.time > lastRepath + repathRate && seeker.IsDone())
{
lastRepath = Time.time;
// Start a new path to the targetPosition, call the the OnPathComplete function
// when the path has been calculated (which may take a few frames depending on the complexity)
seeker.StartPath(transform.position, targetPosition.transform.position, OnPathComplete);
}
Any thoughts what is going on? I can repeat the error every time within about 3 minutes.