//updates a mesh based upon a node
    public void UpdateNode(NodePoint NP, Vector3 pos)
    {
        if (NP.LockedNode)
        {
            return;
        }
        //makes sure nodes are far enough away from each other
        foreach (NodePoint n in Nodes)
        {
            if (NP == n)
            {
                continue;
            }

            if ((pos - n.Posistion).magnitude < minDist)
            {
                Debug.Log("Too Close");
                return;
            }
        }

        //makes sure a node is in front of the current node
        int index = Nodes.IndexOf(NP);

        ///THIS NEEDS TO CHANGE TO INCLUDE WRAPPING FOR LOOPED TRACKS
        if (index != 0)
        {
            Vector3 direction = (pos - Nodes[index - 1].Posistion).normalized;
            //find the forward vector of the last node
            Vector3 forward = Nodes[index - 1].transform.forward;
            //if the direction > forward vector?
            float angle = Vector3.Dot(direction, forward);
            Debug.Log(angle);
            if (angle < -.01f)
            {
                return;
            }
        }

        //need to add code to limit the angle it can be turned.

        NP.SetPosition(pos);

        for (int i = 0; i < Nodes.Count; i++)
        {
            if (Nodes[i] == NP)
            {
                if ((i != Nodes.Count - 1) || (TG.LoopTrack && i == Nodes.Count - 1))
                {
                    TG.DeleteSegment(i);
                    TG.GenerateSegement(i);
                }

                if (i != 0)
                {
                    TG.DeleteSegment(i - 1);
                    TG.GenerateSegement(i - 1);
                }

                if (TG.LoopTrack && i == 0)
                {
                    TG.DeleteSegment(TG.trackSegements.Count - 1);
                    TG.GenerateSegement(Nodes.Count - 1);
                }
            }
        }
    }