I’m using a single navmesh graph with a sphere on it that tries to LineCast to the player. The code always returns true (obstacle found) pointing to the a vertex in the bounding node of the sphere. Even if the player is stood next to the thing. What am I doing wrong?
void Update()
{
GraphNode node = AstarPath.active.GetNearest(transform.position, constraint).node;
GraphHitInfo hitInfo;
Debug.DrawLine(Player.GetFeetPosition(), transform.position);
if ((node.Graph as IRaycastableGraph).Linecast(transform.position, Player.GetFeetPosition(), null, out hitInfo))
{
Debug.DrawLine(transform.position, hitInfo.point, Color.red);
}
else
{
Debug.DrawLine(transform.position, hitInfo.point, Color.green);
}
}