//Get Proxy Position and Orientation generic function for two haptic devices
    public void GetTwoProxyValues()
    {
        /*Two Proxy Position*/

        //Convert IntPtr to Double3Array
        //myTwoProxyPosition = ConverterClass.ConvertIntPtrToDouble6(PluginImport.GetDevicePosition());
        myTwoProxyPosition = ConverterClass.ConvertIntPtrToDouble6(PluginImport.GetProxyPosition());

        //Attach the Cursor Node
        Vector3 positionCursor1 = new Vector3();
        Vector3 positionCursor2 = new Vector3();

        //Assign value to position vector
        positionCursor1 = ConverterClass.ConvertDouble3ToVector3(ConverterClass.SelectHalfdouble6toDouble3(myTwoProxyPosition, 1));
        positionCursor2 = ConverterClass.ConvertDouble3ToVector3(ConverterClass.SelectHalfdouble6toDouble3(myTwoProxyPosition, 2));

        //Assign Haptic Values to Cursor
        myHapticClassScript.hapticCursor.transform.position = positionCursor1;

        //Assign Haptic Values to Cursor
        myHapticClassScript.secondHapticCursor.transform.position = positionCursor2;



        //Proxy Orientation
        //Convert IntPtr to Double4Array
        myTwoProxyOrientation = ConverterClass.ConvertIntPtrToDouble8(PluginImport.GetProxyOrientation());

        //Attach the Cursor Node
        Vector4 OrientationCursor1 = new Vector4();
        Vector4 OrientationCursor2 = new Vector4();

        //Assign value to orientation vector
        OrientationCursor1 = ConverterClass.ConvertDouble4ToVector4(ConverterClass.SelectHalfdouble8toDouble4(myTwoProxyOrientation, 1));
        OrientationCursor2 = ConverterClass.ConvertDouble4ToVector4(ConverterClass.SelectHalfdouble8toDouble4(myTwoProxyOrientation, 2));

        //Assign Haptic Values to Cursor
        myHapticClassScript.hapticCursor.transform.rotation = new Quaternion(OrientationCursor1.x, OrientationCursor1.y, OrientationCursor1.z, OrientationCursor1.w);

        //Assign Haptic Values to Cursor
        myHapticClassScript.secondHapticCursor.transform.rotation = new Quaternion(OrientationCursor2.x, OrientationCursor2.y, OrientationCursor2.z, OrientationCursor2.w);
    }
    // Update is called once per frame
    void Update()
    {
        //Get Pixels - Needed if two Haptic Devices
        boardPixels = boardTexture.GetPixels();

        bool button1State = PluginImport.GetButtonState(deviceNb, 1);

        if (button1State && !previousButton1State)
        {
            penColorNum = (penColorNum + 1) % penColors.Length;
        }
        previousButton1State = button1State;

        //if (PluginImport.GetButtonState(deviceNb,2)) cleanBoard();
        bool eraseState = PluginImport.GetButtonState(deviceNb, 2);

        if (eraseState)
        {
            changePenColor(new Color(0.25f, 0.25f, 0.25f));
        }
        else
        {
            changePenColor(penColorNum);
        }

        //updated the new interface for Dual Haptic Devices
        bool shouldDraw = PluginImport.GetHapticContact(deviceNb) && (myCounter > 0);

        if (shouldDraw)
        {
            //double[] pos = ConverterClass.ConvertIntPtrToDouble3(PluginImport.GetProxyPosition());
            double[] pos = ConverterClass.SelectHalfdouble6toDouble3(ConverterClass.ConvertIntPtrToDouble6(PluginImport.GetProxyPosition()), deviceNb);
            //double[] dir = ConverterClass.ConvertIntPtrToDouble3(PluginImport.GetProxyDirection());
            double[] dir = ConverterClass.SelectHalfdouble6toDouble3(ConverterClass.ConvertIntPtrToDouble6(PluginImport.GetProxyDirection()), deviceNb);

            Vector3 position  = new Vector3((float)pos[0], (float)pos[1], (float)pos[2]);
            Vector3 direction = new Vector3((float)dir[0], (float)dir[1], (float)dir[2]);

            //double[] realPos = ConverterClass.ConvertIntPtrToDouble3(PluginImport.GetDevicePosition());
            double[] realPos      = ConverterClass.SelectHalfdouble6toDouble3(ConverterClass.ConvertIntPtrToDouble6(PluginImport.GetDevicePosition()), deviceNb);
            Vector3  realPosition = new Vector3((float)realPos[0], (float)realPos[1], (float)realPos[2]);

            float force = (realPosition - position).magnitude;

            if (force > 1.0f)
            {
                force = 1.0f;
            }

            RaycastHit hitInfo = new RaycastHit();
            bool       hasHit  = Physics.Raycast(position, direction, out hitInfo);

            if (previousShouldDraw)
            {
                drawBlobLine(previousCoord, hitInfo.textureCoord, blobRadius, penColors[penColorNum], force, blobSteps, eraseState);
            }
            else
            {
                drawBlob(hitInfo.textureCoord, blobRadius, penColors[penColorNum], force, eraseState);
            }
            previousCoord = hitInfo.textureCoord;

            boardTexture.SetPixels(boardPixels);
            boardTexture.Apply();
        }
        previousShouldDraw = shouldDraw;
        myCounter++;
    }