- A* version: [5.3.8] (Pro)
- Unity version: [2022.3.47f1]
There is a problem with Follower Entity when it tries to reach destination that is above its head.
I have staircases in my game, and monster is supposed to walk on them. When monster is chasing player, stoppingDistance is set to 2f, so monster will stop normally near the player (but not very close) and kill him.
But when the player is on the 2nd floor (for example), and monster is running under him on the 1st floor, it suddenly stops moving, showing speed = 0. reachedDestination and reachedEndOfPath are always false (because there is piece of code that checks if destination is above head or lower than 0.5 of height of monster). BUT the remainingDistance is a bit lower than the current stoppingDistance (that was set to 2f), and I assume that this forces Follower Entity to stop.
Gizmos shows correct path to player.
Screenshot of this situation. Player is on the 2nd floor (blue skeleton), monster is under him, path is drawn in orange
And the calculation of remainingDistance is very weird as for me.
First of all, the straight distance between monster and player is way more than 2f.
Second, the full path length must be even longer.
I searched for a code that calculates the remaining distance, and found, that in JobRepairPathHelpers.UpdateReachedEndInfo() it calculates this value using some corners values. When I tried to debug this, it shows me that there is only 2 elements in corners collection - first is the monster position, second is current corner it is avoiding (shown in red on the picture above). Then (in PathTracer.RemainingDistanceLowerBound()) it sums lengths between all corners, and adds the distance from last corner to the end of path (player) ignoring y component of distance (in NativeMovementPlane.ToPlane()).
As far as I understand, that’s the way it gets remainingDistance. And it’s really smaller than stoppingDistance = 2f.
So my questions here:
- Is it a bug? If it is, how can I fix it?
- Is it a problem of bad parameters of Graph / FollowerEntity?
- There is a comment from developer above this code:
// TODO: Edit GetNextCorners so that it gets corners until at least stopDistance units from the agent
Maybe its a fix, and developer has already implemented that. Then what version I am supposed to download, because I can’t find anything about this in release notes of newest versions
I tried to describe as much as I knew
Any help or information will be really appreciated. Thank you!
