Hey！I use the keyboard to control the movement of my character with recast graph. When I press the direction key, I set the target point to a distance in the front direction of the current character. But I found that in some cases, I got the wrong results. For example, there is a gap between the character’s current position and the target point. I hope the character can stop at the edge of the gap, but the character will try to bypass the gap to reach the destination. So I hope to judge whether I can reach the target point in a straight line from my position, so as to solve the problem.Can someone help me?
You can use a graph raycast.
GraphHitInfo hit; bool anyHit = AstarPath.active.data.recastGraph.Linecast(startPoint, endPoint, null, out hit);
I’ll try it. Thank you very much for your guidance