- A* version: [5.3.5]
- Unity version: [2022.3.41f1]
I’m using a Recast Graph. Every time I move the character toward the object, it takes a longer route instead of moving to the closest reachable position near the object. How can I fix this?
Thank you.
In the screenshot you provided, the red arrow is pointing to a intersection of different nodes, rather than a single node itself. It looks like the agent is actually already pathing through the closest node to the target- which would be this one right here:
Ah, I think I asked the question wrong.
What I actually want is for the player to move to the closest point between the player and the tree within the node — not necessarily the point on the node that’s closest to the tree’s position.
As you said, the end of the orange arrow might be the closest to the tree’s position, but I want the agent to move to the point that’s closest in terms of the path from the player to the tree, like in the screenshot.
Is there good way?
I think this is where you’ll want to write your own movement script. You can use this to modify your movement to walk directly towards the tree when it’s in-sight/another condition-- or however you want to handle that part.