Exemple #1
0
    //Returns the nearest node's position from a Vector3 point, will never return null (Vector3.zero), except for when there are no calculated grids.
    public Vector3 GetNearestNodePositionUnclamped(Vector3 pos)
    {
        Int3 p = AstarPath.ToLocalUnclamped(pos);

        if (p != new Int3(-1, -1, -1))
        {
            return(AstarPath.GetNode(p).vectorPos);
        }
        else
        {
            return(Vector3.zero);
        }
    }