Support Forum

Point Graph - Repath issue

Hi,

I’m using a point graph for a 2.5D platformer. It works pretty well for the most. I just get the next node in the graph and based on it’s position compared to my AI I can tell my AI whether to go left or right. Pretty straight forward.

However, if I Repath (which I want to do as my target - the player - may change position) it often selects the node behind it as the starting node of the new graph so briefly goes backward before correctly following the path again.

I assume it selects the node behind it sometimes as that’s technically closer, but I’m not sure why that would ever be desirable. Is there something I can do to prevent this so it only selects the next node that is along the desired path when repathing?

Thanks, MD

Hi

You may want to change the Seeker -> Start End Modifier -> Start Point and End Point fields to Node Connection. That will allow it to start the path on a connection between two nodes instead of just at the node positions.

Thank you for the tip and prompt response!

Hey, I just saw that you were targeting the next node to control your AI’s movement. I’ve been trying to do the same thing, but haven’t been able to find how you get the next node’s position. How do you actually get the next node and its position?

Check out the documentation here: https://arongranberg.com/astar/documentation/4_2_1_d6eff531/custom_movement_script.html

Essentially, path.vectorPath[currentWaypoint] is the vector3 position of the currentwaypoint you need to move towards. You can then just compare this to your transform.position to decide which way to go.

Hope that helps!

1 Like

Thanks for the quick response! That definitely looks like what I’ve been looking for. Thanks!

1 Like