Hi,
I have some troubles. I’m using RecastGraph, but the path will have some errors. As mentioned in the documentation, I tried to use Linecast, as you suggested in the forum, but I do not know why he didnt walk according to the specified path, that is, walking in a straight line, the following is my script,Thanks so much, Aaron.
var g = AstarPath.active.data.recastGraph;
bool tks = g.Linecast(transform.position, targetPostion);
if (tks == true)
{
seeker.pathCallback += OnPathComplete;
seeker.StartPath(transform.position,targetPostion, OnPathComplete);
}
else
{
ABPath path1 = ABPath.Construct(transform.position, targetPostion);
path1.vectorPath.Add(transform.position);
path1.vectorPath.Add(targetPostion);
var Cs = path1.CompleteState;
Cs = PathCompleteState.Complete;
OnPathComplete(path1);
Ai.destination = targetPostion;
}