//Returns the nearest node's position from a Vector3 point, this function can return null (Vector3.zero) if the point is not contained inside any grids bounds. public Vector3 GetNearestNodePosition(Vector3 pos) { Int3 p = AstarPath.ToLocal(pos); if (p != new Int3(-1, -1, -1)) { return(AstarPath.GetNode(p).vectorPos); } else { return(Vector3.zero); } }
//Returns the nearest node from a Vector3 point, this function can return null if the point is not contained inside any grids bounds. public Node GetNearestNode(Vector3 pos) { Int3 p = AstarPath.ToLocal(pos); if (p != new Int3(-1, -1, -1)) { return(AstarPath.GetNode(p)); } else { return(null); } }