How can i make the pathfind not so smart?

Hi

how can i make the pathfind not so smart?

i’m using NavMesh + RichAI + NavMeshCut

what i am doing is

let a monster attack an area surround by walls.

for now , if some where have a break point (wall has been destroy), all the monster will turn around ,try to get in from that point.

what i want is keep that feature but in a small distance, so if the break point is far away from current position, the monster will ignore that.

how can i do that

thanks.

Not really A* related, more of an AI question.

But you can calculate the length of the generated path and if it’s “much” longer than the sum of paths to the closest wall + path from closest wall to final destination, then attack said wall.

1 Like

Hi.

thanks for reply.

sorry not reply soon, i was busy on something else :frowning:

so . for now i try to calculate a path before RichAI.SetDestation. (so that if the path is to long then ignore the target).

but i can’t get the right path.

what i do is:

//Call for path calucalte
var p = ABPath.Construct(startPos, endPos, OnPathComplete);
AstarPath.StartPath(p, true);
Debug.DrawLine(startPos, endPos, Color.white, 2f);

private void OnPathComplete(Path p)
{
    GameFunnelModifier.Instance.Apply(p); //Global GameObject with FunnelModifier attach
  
    for (int i = 0; i < p.vectorPath.Count - 1; i++)
    {
        var s = p.vectorPath[i];
        var e = p.vectorPath[i + 1];
        s.y = e.y = 2f;
        Debug.DrawLine(s, e, Color.green, 2f);
    }
}

the white line is showing the start and end pos i was request for path calculate.

the green line the path result with FunnelModifier.


so how can i get the right path?

thanks.