I’m using v.5.0.6 on Unity 2022.3.21f1.
The agent (a car) starts on a racetrack, which is configured with a Recast graph. The agent is using FollowerEntity and AIDestinationSetter. The Target of the AIDestinationSetter is set when the scene loads and is not changed at all. Additionally, all other GameObjects in the scene are stationary (for testing purposes) and are correctly detected as unwalkable by the Scan process.
The length of the racetrack is 3,000m (world units). I have set the “Movement Debug Rendering” to “Path”, and I can see that a path is always available.
With the FollowerEntity - “Recalculate Paths Automatically” set to “Dynamic” and the “Maximum Period” set to the default 2s, in every run, the agent follows the path quite well, but at about 2,000m, it slides from the middle of the track to the left side, apparently with 0 speed in the direction of the path, for about 1 second. When I pause play and move frame by frame, the agent goes forwards & backwards 0.5m for about 30-40 frames and then continues normally until the destination is reached.
Even though I could see from the debug rendering of the path that a path was available at all times, I suspected that, for some reason, a path wasn’t available momentarily causing the issue.
So, I made some tests with the “Maximum Period” set to 1s and 0.5s, and the “sliding” seemed to become less and less. So, I set the “Maximum Period” to 0s, and the sliding disappeared, and the problem was fixed.
However, it doesn’t seem right to set the “Maximum Period” to 0s, especially since the destination doesn’t change, there are only 3 stationary obstacles before the destination is reached, and there’s no other action taking place.
I have attached some screenshots to show the problem:
-
Correct movement of agent in the middle of the track:
-
Sudden sliding movement to the left:
-
The agent getting stuck for 30-40 frames moving forwards & backwards 0.5m:
-
Agent continues to its path:
Is there a workaround for this?
Thank you in advance.