Trouble getting project working

I am following the tutorial to getting A* pathfinding working. I have not had any success yet.

First I created a plane and named it ground. Secondly I added it to a new layer called ground (I am not going to try obstacles yet).

I then created an empty game object named A*. I added the AStarPath script to it. I then added a grid graph to it. I added the layer “ground” to the mask. I then scanned.

I added a cube to the world. I set a seeker script on it, and a CharacterController. I then added my own script that gets the seeker and calls StartPath with two valid world coordinates. I have added logs to ensure that start path is being called.

A* project logs this…

`Path Completed : Computation Time 2.00 ms Searched Nodes 0 Path Length 1
Path Number 1
UnityEngine.Debug:Log(Object)
AstarPath:LogPathResults(Path) (at Assets/AstarPathfindingProject/Core/AstarPath.cs:804)
<CalculatePaths>c__Iterator7:MoveNext() (at Assets/AstarPathfindingProject/Core/AstarPath.cs:2662)
AstarPath:Update() (at Assets/AstarPathfindingProject/Core/AstarPath.cs:846)

`

Then I also receive this log

Path Failed : Computation Time 0.00 ms Searched Nodes 0 Error: Couldn't find close nodes to the start point or the end point Path Number 1 UnityEngine.Debug:Log(Object) AstarPath:LogPathResults(Path) (at Assets/AstarPathfindingProject/Core/AstarPath.cs:804) <CalculatePaths>c__Iterator7:MoveNext() (at Assets/AstarPathfindingProject/Core/AstarPath.cs:2662) AstarPath:Update() (at Assets/AstarPathfindingProject/Core/AstarPath.cs:846)

I should add that all my nodes are red. Which I have learned means they are no good. My grid is at the exact same height as my plane.

I have also placed the graph at 0.1 lower than the ground

Hi

I think what is happening is that the system detects your ground as an obstacle.
Make sure the the Collision Testing mask in the grid graph settings does not include the layer that the ground is in.

That did fix it but a new problem has arisen. I have just completed the “Getting started with the A* pathfinding project” section of the tutorial. I just finished the part “the end”.

I am working in a top down RTS view. I am issuing moves to the Seeker using mouse clicks. Everything I am doing is identical to the tutorial, with the exception of where the positions are coming from…

` RaycastHit hit;

    Ray ray = Camera.main.ScreenPointToRay(end);

    if (Physics.Raycast(ray,out hit)) {
        seeker.StartPath(transform.position, hit.point, OnPathComplete);
    }` 

My location issuing is working, as I had it working with Unity’s built in NavMesh and a NavMeshAgent. The agent would properly arrive right at where I clicked.

But using A* pathfinding project, the AI always stops short. About 2 units short everytime. I can’t figure out why this is!

Also the sphere keep dropping and clipping about 1/4 into the plane all the time…

Hi

It will stop short because the script that is written in the get started tutorial is not very advanced (for lack of space), if it detects that the end waypoint is closer than the ‘pick next waypoint distance’ it will simply stop. You can modify it to not simply stop when it finds the end waypoint.

Check the CharacterController, it will line up with the collider below it, also check the collider position for the ground.

Thanks for the reply. I changed the code a little and it works now.