Wander problems

Willyx

New member
Hi, i'm using lastest A* pro 4.3.79. There are 2 main problems in wander (2D flag on):
In line 37 u should check also ReachedEndOfPath , something like if (!HasPath() || HasArrived() || ReachedEndOfPath()) {
Maybe is a new flag of A* beta, but with that check agents will not be stuck forever trying to get on a wall (image ex.jpg).
There is a possibility that the agent have a path but cannot reach it. To fix that case my final code of line 37 is:
if ((!HasPath() || HasArrived() || ReachedEndOfPath()) || (!HasPending() && !ReachedEndOfPath() && !HasArrived()) ){

But the root problem is the use of:
protected Vector3 SamplePosition(Vector3 position)
{
return (Vector3)AstarPath.active.GetNearest(position).node.position;
}

Return the Nearest node, but this could be a wall, like in the image. U should check first if is walkable (node.Walkable).
And I suppose that
SetDestination(SamplePosition(destination));
return true;
should be
return SetDestination(SamplePosition(destination));

Second problem is that if wander is the first action, the agent select something outside the graph (ex1.jpg). In the image i've 3 agents and at the start they run always in that points. A stupid fix is to wait half second before the wander. Maybe this is a problem with my scripts order, not a big trouble.
 

Attachments

  • ex.jpg
    ex.jpg
    25.9 KB · Views: 6
  • ex1.jpg
    ex1.jpg
    84 KB · Views: 4
Last edited:
I am currently at devcom and am not able to take a closer look at this right now. I have made a note to take a look at this next week when I am able to.
 
Hello, was this ever resolved I am having the exact same issue. I've noticed all over this board people complaining about Wander with Astar Pathfinding Project Intergration. People have been complaining about this for "many" years, why is this not fixed already? Why should your paying customers have to hunt down independent code from this message board to fix your controller that we paid good money for. I would imagine that Wander task is the most popular task in the movement pack for a variety of potential games(if anything it should work flawless even if nothing else does!)_, and it doesn't work. Please fix this asap!
 
Last edited:
The A* integration was recently updated with this fix. Have you tried the most recent version?
 
Hi, i've just read the reply to Christ and checked the updated version of A* integrations. I missed that the fix had been released.
However...It works(y)
How do i know when a new release of A* integrations is out? There is no version and even the filename is the same:(
 
Last edited:
When there's a new Movement Pack release I will include it in the release notes. I don't have a good way for these intermittent releases.
 
Hi again! :)
There is another problem with wander, if wander choose a position that cannot reach, it stucks here forever.
I know that u tested !HasPath() in OnUpdate, but maybe this flag is broken (a*? ). I'm using A* pro 4.3.84
 

Attachments

  • wander1.png
    wander1.png
    48.2 KB · Views: 5
Can you tell me how to reproduce it within the A* demo scene? From there I will be able to determine if it's an A* problem or not.
 
I'll check and re-reply tonight, but (probably ) any scene with wander have this problem, just leave it run for 5 minutes ( i remember that they get stucks in the demo).
The problem is that u use HasPath. It checks if there is a "try" to make a path, not if is possible.
A* have a static function PathUtilities.IsPathPossible to check if the path is possible. Yes, its not so clear...
 
Just close the inner quad as in picture. Wait and sooner or later wander will choose a point outside the cage and locks the bot.
Not i've added a (!HasPending() && !ReachedEndOfPath() && !HasArrived()) ) to unlock, but is better to not choose a point that cannot reach.
Good work :)
 

Attachments

  • wanderbug.png
    wanderbug.png
    112.5 KB · Views: 6
Last edited:
I'm seeing the same issue with Wander. Just downloaded the A* integration today from the website and that bool check line in OnUpdate is still the old code:
Code:
if (!HasPath() || HasArrived())
 
I was able to resolve without the bool check fix mentioned above by changing IAstarAIMovement's SamplePosition
Code:
protected Vector3 SamplePosition(Vector3 position, ref bool valid)
{
    GraphNode nearestNodeToAgent = AstarPath.active.GetNearest(agent.position).node;
    GraphNode nearestNode = AstarPath.active.GetNearest(position).node;
    if (PathUtilities.IsPathPossible(nearestNodeToAgent, nearestNode))
    {
        valid = true;
        return (Vector3)nearestNode.position;
    }
    valid = false;
    return position;
}
 
Top