A* Pathfinding Project

Problems with Linecast walking straight


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);
                    ABPath path1 = ABPath.Construct(transform.position, targetPostion);
                    var Cs = path1.CompleteState;
                    Cs = PathCompleteState.Complete;
                    Ai.destination = targetPostion;



I’m not really sure what you are doing in that script. It seems like you are using an AIPath script and setting the .destination property, but you are also doing path requests manually…



Is the linecast working as expected?
Also, is this in a separate script or as a subclass of he AIPath script or something?