I have a very bag but when doing pathfinding and chasing the player using:
if (_richAi.remainingDistance <= 0.3)
{
return TaskStatus.Success;
}
I use this code to see if the AI is close to the player so it can start attacking.
Now 20% of the times when I debug log my distance it goes slowly from 25 to 24.8, 24.6 etc up until 8 and it goes straight down to 0.2
It happens on the exact same location (I think) of my terrain, the navmesh there is built properly it’s just a flat terrain surface. Why would the remaining distance go from 8 to 0.2 straight up? As I said it only happens 15-20% of the times, during the other ~80% everything is good, but I want to fix that issue.
I did some patch notes digging and I see that similar issues have been fixed in previous versions before 4.3.60 so I wonder if this is a lingering issue of some sort. By any chance, does is snap down to 0.2 when a new path is calculated (such as when path recalculation is set to dynamic)? Also is it always exactly 8 then straight to 0.2 each time?
I have had simmilar problems With reachedEndOfPath bool and remaining distance. Ended up using Vector3.Distance to check real distance between AI and target position.
I’m going to try a new version and about your question I got no idea, because I have to do some testing. About your second question yes, since I stay on the same spot and test a cinematic kind of scene where enemy gets spawned in-front and moves to the player so player is always at the same position and yes it does snap from 8 to 0.2
That’s an ok approach, but in my case I will want to check for the remainingDistance it fits my AI much better at this point. So if two of us got that bug, it’s a serious thing and I will test newer versions to investigate further.
Do you recommend updating from my version 4.3.60 to Version 5.2.5 which is on the asset store? Is that upgrade smooth (i’m in production). Thanks again.
I’d highly recommend making a copy of your project and testing it before anything. I’d be pretty irresponsible to say “yes” or “no” directly- However I can point you to this upgrade guide for 5.0. There were also some breaking changes in 5.2.0, viewable here in the changelog.
If you run into any issues with the upgrade please let us know