//function for letting go of a vertex
    public void letGo()
    {
        if (!currentRigidBody)
        {
            return;
        }
        else
        {
            if (!currentGameObject.active)
            {
                //don't bother letting go if currentRigidBody is already been deactivated (aka removed)
                return;
            }
            else
            {
                currentGameObject.transform.parent = currentVertexManager.getBaseLineParent();
                currentVertexManager.setIsSelected(false);

                Vector3 yToSnap = snap();
                currentVertexManager.moveTo(yToSnap);
                currentVertexManager.onPutDown();
                resetVariables();
            }
        }
    }
 //method to see whether a vertex is currently close enough to the controller to be considered "hovering over"
 public GameObject hoverOverVertex()
 {
     if (GetNearestRigidBody())
     {
         GameObject nearestVertex       = GetNearestRigidBody().gameObject;
         Vector3    nearestVertexVector = nearestVertex.transform.position;
         if (Vector3.Distance(transform.position, nearestVertexVector) < 0.1f)
         {
             //is within range
             VertexManager nearestVertexManager = nearestVertex.GetComponent <VertexManager>();
             if (isEditable(nearestVertexManager.getVertexID(), nearestVertexManager.getBaseLineParent().gameObject))
             {
                 //is "editable"
                 return(nearestVertex);
             }
         }
     }
     return(null);
 }
    //method that is called when the controller should pick up the nearest rigid body
    public void pickUp()
    {
        currentRigidBody = GetNearestRigidBody();
        if (!currentRigidBody)
        {
            return;
        }
        else
        {
            //if statement checking the id of the vertex:
            if (currentRigidBody.GetComponent <VertexManager>().getBaseLineParent().GetComponent <LineManager>().getNumberOfVertices() - 1 == currentRigidBody.GetComponent <VertexManager>().getVertexID())
            {
                //if the id is the last in the line, cycle the voice of the line
                currentRigidBody.GetComponent <VertexManager>().getParentsLineManager().cycleVoices();
                resetVariables();
            }
            else
            {
                //set current-XYZ variables
                currentGameObject    = currentRigidBody.gameObject;
                currentVertexManager = currentRigidBody.GetComponent <VertexManager>();
                currentVertexManager.setIsSelected(true);


                Vector3 oldPos = currentGameObject.transform.position;

                //set the rigidBody parent and position to the controller holding it.
                currentRigidBody.transform.parent   = gameObject.transform;
                currentRigidBody.transform.position = transform.position;
                fixedJoint.connectedBody            = currentRigidBody;
                currentVertexManager.onPickUp();

                //if statement to check whether the id of the vertex is editable, if it isn't, act as if a new vertex should be made:
                if (!isEditable(currentVertexManager.getVertexID(), currentVertexManager.getBaseLineParent().gameObject))
                {
                    VertexManager newlyCreatedVertexManager = addNewVertex().GetComponent <VertexManager>();
                    newlyCreatedVertexManager.moveTo(oldPos);
                }
            }
        }
    }