Weird path (agent goes back and covers more ground)

Hi there,

I’m using a Point Graph (nodes are the purple dots on the screen) and when my agent (red elipse) is supposed to reach the player (blue elipse) it generated the path marked by the green lines.

The snapping on the seeker for the agent is set to original and all the nodes have the same penalty value.

Is that the intended behaviour? Can I make it so it goes directly to the player is any node is further?

Thanks!

Hi

The path always goes between nodes. So what I’m guessing happens in this case is that the closest node to the blue character is the one to the top-left of it. The closest one to the red character is the one to the top-left of that one. Your max node distance seems to be set such that there is no direct connection between the two nodes closest to the characters.
image

I’m not sure why you are using a point graph for this scenario. It seems like a grid or a recast graph would be a much better fit. They work a lot better for open areas like that.

Thanks for the quick reply!

astar2

At this moment the path calculated for the red character is going to node 2 and then to the blue player. The green line in the picture is a bit different because I’m using a smooth modifier.

My question was if there was an option considering that going from node 2 to the blue character is longer than current position to blue player to just take that path. Does it need to go through at least one node always?

As for the point graph, now I don’t remember why I started using it, I have pro. Not sure if it was because the scenarios were too big and I thought the point graph would be less demanding, also I have some randomly generated scenarios. it was long time ago when I decided to use that. I might give a try to the grid in the future and see if it all goes well.

I think the path is actually like the red path I drew. It looks like the yellow path because of the snapping options you have set. The “Original” snapping option will replace the position of the first/last node with the exact start/end of the path that you requested (i.e. the characters’ positions).

You may be able to use the RaycastModifier to help simplify the path a lot, but it’s only bandaid in this case.

I think you should try a grid or recast graph. You’ll get much better and more consistent results with those and you will not have to place all the nodes manually.

1 Like