Can't getting started with "Get Started With The A* Pathfinding Project"

Hey …I am a beginner. I am following tutorial ‘get started …’ , but I stuck at title ‘Moving Stuff Around’, i can’t get the green line connect start to end pos just like the image attached the tutorial.
My green line just like a lint on my capsule…and i log out the info of ‘startnode’ and ‘endnode’ of parameter ‘path’ passed by ‘OnPathComplete(Path path)’ function. startnode[x:50,z:50] endnode[x:50,z:49](the end node should be [80,20] here)…

notes the cute green lint i marked up by red circle in the screen-capture…It makes me crush…:sob:

and my code followed…

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

using Pathfinding;

public class AstarAI : MonoBehaviour {

public GameObject Target;

public void Start () {
	
	//Get a reference to the Seeker component we added earlier
	Seeker seeker = GetComponent<Seeker>();
	//Start a new path to the targetPosition, return the result to the OnPathComplete function
	seeker.StartPath (transform.position, Target.transform.position, OnPathComplete);
}

public void OnPathComplete (Path p) {
	Debug.Log ("Yay, we got a path back. Did it have an error? "+p.error);
}

}

What is the problem ? Thanks!!

Hi

It looks like you haven’t excluded the agent and the target point from ‘height testing’ mask in the grid graph settings.
You can see that the graph has been affected by the agent.

What I think has happened in this case is that a few nodes have been placed on the agent’s head and those nodes are disconnected from the rest of the graph. Put the agent in a layer and make sure that that layer is not included in the layer mask for ‘Height Testing’ or ‘Collision Testing’ in the grid graph settings.

1 Like

Haha!!!It works!!
Thanks!! :slight_smile::grin::grinning::laughing:

1 Like