void Update()
    {
        /***************************************************************/
        //Update Workspace as function of camera
        /***************************************************************/
        //PluginImport.UpdateWorkspace(myHapticCamera.transform.rotation.eulerAngles.y);  //To be deprecated

        //Update the Workspace as function of camera
        for (int i = 0; i < workspaceUpdateValue.Length; i++)
        {
            workspaceUpdateValue[i] = myHapticCamera.transform.rotation.eulerAngles.y;
        }

        PluginImport.UpdateHapticWorkspace(ConverterClass.ConvertFloatArrayToIntPtr(workspaceUpdateValue));

        /***************************************************************/
        //Update cube workspace
        /***************************************************************/
        myGenericFunctionsClassScript.UpdateGraphicalWorkspace();

        /***************************************************************/
        //Haptic Rendering Loop
        /***************************************************************/
        PluginImport.RenderHaptic();

        //Associate the cursor object with the haptic proxy value
        myGenericFunctionsClassScript.GetProxyValues();
    }
    void Update()
    {
        /***************************************************************/
        //Act on the rigid body of the Manipulated object
        // if Mode = Manipulation Mode
        /***************************************************************/
        if (PluginImport.GetMode() == 1)
        {
            ActivatingGrabbedObjectPropperties();
        }

        /***************************************************************/
        //Update Workspace as function of camera
        /***************************************************************/
        PluginImport.UpdateWorkspace(myHapticCamera.transform.rotation.eulerAngles.y);

        /***************************************************************/
        //Update cube workspace
        /***************************************************************/
        myGenericFunctionsClassScript.UpdateGraphicalWorkspace();

        /***************************************************************/
        //Haptic Rendering Loop
        /***************************************************************/
        PluginImport.RenderHaptic();

        myGenericFunctionsClassScript.GetProxyValues();

        myGenericFunctionsClassScript.GetTouchedObject();

        //Debug.Log ("Button 1: " + PluginImport.GetButton1State());
        //Debug.Log ("Button 2: " + PluginImport.GetButton2State());
    }
Esempio n. 3
0
    void Update()
    {
        /***************************************************************/
        //Update Workspace as function of camera
        /***************************************************************/
        //PluginImport.UpdateWorkspace(myHapticCamera.transform.rotation.eulerAngles.y);//To be deprecated

        //Update the Workspace as function of camera
        //for (int i = 0; i < workspaceUpdateValue.Length; i++)
        //workspaceUpdateValue[i] = myHapticCamera.transform.rotation.eulerAngles.y;

        //PluginImport.UpdateHapticWorkspace(ConverterClass.ConvertFloatArrayToIntPtr(workspaceUpdateValue));

        /***************************************************************/
        //Update cube workspace
        /***************************************************************/
        myGenericFunctionsClassScript.UpdateGraphicalWorkspace();

        /***************************************************************/
        //Haptic Rendering Loop
        /***************************************************************/
        PluginImport.RenderHaptic();

        //Associate the cursor object with the haptic proxy value
        myGenericFunctionsClassScript.GetProxyValues();

        //myGenericFunctionsClassScript.GetTouchedObject();

        //Debug.Log ("Button 1: " + PluginImport.GetButton1State()); // To be deprecated
        //Debug.Log ("Button 2: " + PluginImport.GetButton2State()); // To be deprecated

        //Debug.Log("Device 1: Button 1: " + PluginImport.GetButtonState(1, 1));
        //Debug.Log("Device 1: Button 2: " + PluginImport.GetButtonState(1, 2));
    }
Esempio n. 4
0
    void Update()
    {
        /***************************************************************/
        //Update forces
        /***************************************************************/
        UpdateForces();

        /***************************************************************/
        //Update UI
        /***************************************************************/
        UpdateUI();

        /***************************************************************/
        //Update Workspace as function of camera
        /***************************************************************/
        PluginImport.UpdateWorkspace(myHapticCamera.transform.rotation.eulerAngles.y);

        /***************************************************************/
        //Update cube workspace
        /***************************************************************/
        myGenericFunctionsClassScript.UpdateGraphicalWorkspace();

        /***************************************************************/
        //Haptic Rendering Loop
        /***************************************************************/
        PluginImport.RenderHaptic();

        myGenericFunctionsClassScript.GetProxyValues();

        //myGenericFunctionsClassScript.GetTouchedObject();
        myGenericFunctionsClassScript.manipulateObject();
    }
Esempio n. 5
0
    void Update()
    {
        if (cochlea == null)
        {
            cochlea = StatsManager.instance.GetActiveCochlea();
        }

        if (PluginImport.GetButtonState(1, 2))
        {
            if (!hasStarted) // user hasn't pressed start
            {
                DetachCochlea();
                hasStarted = true;
            }
        }

        if (PluginImport.GetButtonState(1, 1) & !hasEnded)
        {
            hasEnded = true;
            StatsManager.instance.SetFullReset(false);
            simMonitor.IncrementReset();
            SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
        }

        /***************************************************************/
        //Update Workspace as function of camera
        /***************************************************************/
        //PluginImport.UpdateWorkspace(myHapticCamera.transform.rotation.eulerAngles.y);//To be deprecated

        //Update the Workspace as function of camera
        for (int i = 0; i < workspaceUpdateValue.Length; i++)
        {
            workspaceUpdateValue[i] = myHapticCamera.transform.rotation.eulerAngles.y;
        }

        PluginImport.UpdateHapticWorkspace(ConverterClass.ConvertFloatArrayToIntPtr(workspaceUpdateValue));

        /***************************************************************/
        //Update cube workspace
        /***************************************************************/
        myGenericFunctionsClassScript.UpdateGraphicalWorkspace();

        /***************************************************************/
        //Haptic Rendering Loop
        /***************************************************************/
        PluginImport.RenderHaptic();

        //Associate the cursor object with the haptic proxy value
        myGenericFunctionsClassScript.GetProxyValues(isKinematic);
    }
    void Update()
    {
        /***************************************************************/
        //Act on the rigid body of the Manipulated object
        // if Mode = Manipulation Mode
        /***************************************************************/
        if (PluginImport.GetMode() == 1)
        {
            ActivatingGrabbedObjectPropperties();
        }

        /***************************************************************/
        //Update Workspace as function of camera
        /***************************************************************/
        PluginImport.UpdateWorkspace(myHapticCamera.transform.rotation.eulerAngles.y);

        /***************************************************************/
        //Update cube workspace
        /***************************************************************/
        myGenericFunctionsClassScript.UpdateGraphicalWorkspace();

        /***************************************************************/
        //Haptic Rendering Loop
        /***************************************************************/
        PluginImport.RenderHaptic();

        myGenericFunctionsClassScript.GetProxyValues();

        myGenericFunctionsClassScript.GetTouchedObject();

        //Debug.Log ("Button 1: " + PluginImport.GetButton1State());
        //Debug.Log ("Button 2: " + PluginImport.GetButton2State());

        if (PluginImport.GetButton2State())
        {
            makeJengaBlocks();
        }

        const float rotSpeed = 1.0f;

        if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow))
        {
            myHapticCamera.transform.RotateAround(Vector3.zero, new Vector3(0.0f, 1.0f, 0.0f), rotSpeed);
        }
        if (Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow))
        {
            myHapticCamera.transform.RotateAround(Vector3.zero, new Vector3(0.0f, 1.0f, 0.0f), -rotSpeed);
        }
    }
    void Update()
    {
        /***************************************************************/
        //Update two Workspaces as function of camera for each
        /***************************************************************/
        //PluginImport.UpdateTwoWorkspace(myHapticCamera.transform.rotation.eulerAngles.y, myHapticCamera.transform.rotation.eulerAngles.y);

        //Update the Workspace as function of camera - Note that two different reference can be used to update each workspace
        for (int i = 0; i < workspaceUpdateValue.Length; i++)
        {
            workspaceUpdateValue[i] = myHapticCamera.transform.rotation.eulerAngles.y;
        }

        PluginImport.UpdateHapticWorkspace(ConverterClass.ConvertFloatArrayToIntPtr(workspaceUpdateValue));

        /***************************************************************/
        //Update 2 cubes workspaces
        /***************************************************************/
        myGenericFunctionsClassScript.UpdateTwoGraphicalWorkspaces();

        /***************************************************************/
        //Haptic Rendering Loop
        /***************************************************************/
        PluginImport.RenderHaptic();

        /***************************************************************/
        //Update Haptic Object Transform
        /***************************************************************/
        myGenericFunctionsClassScript.UpdateHapticObjectMatrixTransform();

        //myGenericFunctionsClassScript.GetProxyValues();
        myGenericFunctionsClassScript.GetTwoProxyValues();

        //myGenericFunctionsClassScript.GetTouchedObject();

        /*Debug.Log("Device 1: Button 1: " + PluginImport.GetButtonState(1, 1));
        *  Debug.Log("Device 1: Button 2: " + PluginImport.GetButtonState(1, 2));
        *  Debug.Log("Device 2: Button 1: " + PluginImport.GetButtonState(2, 1));
        *  Debug.Log("Device 2: Button 2: " + PluginImport.GetButtonState(2, 2));*/

        /*if(PluginImport.GetHapticContact(1))
         *  Debug.Log("Device 1 touches: " + PluginImport.GetTouchedObjId(1) + " " + ConverterClass.ConvertIntPtrToByteToString(PluginImport.GetTouchedObjName(1)));
         * if (PluginImport.GetHapticContact(2))
         *  Debug.Log("Device 2 touches: " + PluginImport.GetTouchedObjId(2) + " " + ConverterClass.ConvertIntPtrToByteToString(PluginImport.GetTouchedObjName(2)));*/
    }
Esempio n. 8
0
    void Update()
    {
        /***************************************************************/
        //Update Workspace as function of camera
        /***************************************************************/
        //PluginImport.UpdateWorkspace(myHapticCamera.transform.rotation.eulerAngles.y);//To be deprecated

        //Update the Workspace as function of camera
        for (int i = 0; i < workspaceUpdateValue.Length; i++)
        {
            workspaceUpdateValue[i] = myHapticCamera.transform.rotation.eulerAngles.y;
        }

        PluginImport.UpdateHapticWorkspace(ConverterClass.ConvertFloatArrayToIntPtr(workspaceUpdateValue));

        /***************************************************************/
        //Update cube workspace
        /***************************************************************/
        myGenericFunctionsClassScript.UpdateGraphicalWorkspace();

        /***************************************************************/
        //Haptic Rendering Loop
        /***************************************************************/
        PluginImport.RenderHaptic();

        //Associate the cursor object with the haptic proxy value
        myGenericFunctionsClassScript.GetProxyValues();

        //myGenericFunctionsClassScript.GetTouchedObject();

        //Reset the writing on the board
        //if(ConverterClass.ConvertIntPtrToByteToString( PluginImport.GetTouchedObjectName()) == "reset") // GetTouchedObjectName - To be deprecated
        if (ConverterClass.ConvertIntPtrToByteToString(PluginImport.GetTouchedObjName(1)) == "reset")
        {
            myWritingScript.cleanBoard();

            //Change the Color of the button material
            myResetButton.GetComponent <Renderer>().material.color = buttonResetColors[1];
        }
        else
        {
            myResetButton.GetComponent <Renderer>().material.color = buttonResetColors[0];
        }
    }
    void Update()
    {
        if (PluginImport.GetButtonState(1, 2))
        {
            DetachCochlea();
        }

        if (PluginImport.GetButtonState(1, 1) & !hasEnded)
        {
            hasEnded = true;
            simMonitor.End();
        }

        /***************************************************************/
        //Update Workspace as function of camera
        /***************************************************************/
        //PluginImport.UpdateWorkspace(myHapticCamera.transform.rotation.eulerAngles.y);//To be deprecated

        //Update the Workspace as function of camera
        for (int i = 0; i < workspaceUpdateValue.Length; i++)
        {
            workspaceUpdateValue[i] = myHapticCamera.transform.rotation.eulerAngles.y;
        }

        PluginImport.UpdateHapticWorkspace(ConverterClass.ConvertFloatArrayToIntPtr(workspaceUpdateValue));

        /***************************************************************/
        //Update cube workspace
        /***************************************************************/
        myGenericFunctionsClassScript.UpdateGraphicalWorkspace();

        /***************************************************************/
        //Haptic Rendering Loop
        /***************************************************************/
        PluginImport.RenderHaptic();

        //Associate the cursor object with the haptic proxy value
        myGenericFunctionsClassScript.GetProxyValues(isKinematic);
    }
Esempio n. 10
0
    void Update()
    {
        /***************************************************************/
        //Update Workspace as function of camera
        /***************************************************************/
        PluginImport.UpdateWorkspace(myHapticCamera.transform.rotation.eulerAngles.y);

        /***************************************************************/
        //Update cube workspace
        /***************************************************************/
        myGenericFunctionsClassScript.UpdateGraphicalWorkspace();

        /***************************************************************/
        //Haptic Rendering Loop
        /***************************************************************/
        PluginImport.RenderHaptic();

        myGenericFunctionsClassScript.GetProxyValues();

        myGenericFunctionsClassScript.GetTouchedObject();

        //Debug.Log ("Button 1: " + PluginImport.GetButton1State());
        //Debug.Log ("Button 2: " + PluginImport.GetButton2State());

        //Reset the writing on the board
        if (ConverterClass.ConvertIntPtrToByteToString(PluginImport.GetTouchedObjectName()) == "reset")
        {
            myWritingScript.cleanBoard();

            //Change the Color of the button material
            myResetButton.GetComponent <Renderer>().material.color = buttonResetColors[1];
        }
        else
        {
            myResetButton.GetComponent <Renderer>().material.color = buttonResetColors[0];
        }
    }
Esempio n. 11
0
    void Update()
    {
        /***************************************************************/
        //Update Workspace as function of camera
        /***************************************************************/
        PluginImport.UpdateWorkspace(myHapticCamera.transform.rotation.eulerAngles.y);

        /***************************************************************/
        //Update cube workspace
        /***************************************************************/
        myGenericFunctionsClassScript.UpdateGraphicalWorkspace();

        /***************************************************************/
        //Haptic Rendering Loop
        /***************************************************************/
        PluginImport.RenderHaptic();

        myGenericFunctionsClassScript.GetProxyValues();

        myGenericFunctionsClassScript.GetTouchedObject();

        //Debug.Log ("Button 1: " + PluginImport.GetButton1State());
        //Debug.Log ("Button 2: " + PluginImport.GetButton2State());
    }
Esempio n. 12
0
    void Update()
    {
        /***************************************************************/
        //Act on the rigid body of the Manipulated object
        // if Mode = Manipulation Mode
        /***************************************************************/
        if (PluginImport.GetMode() == 1)
        {
            ActivatingGrabbedObjectPropperties();
        }

        /***************************************************************/
        //Update Workspace as function of camera
        /***************************************************************/
        //PluginImport.UpdateWorkspace(myHapticCamera.transform.rotation.eulerAngles.y);  //To be deprecated

        //Update the Workspace as function of camera
        for (int i = 0; i < workspaceUpdateValue.Length; i++)
        {
            workspaceUpdateValue[i] = myHapticCamera.transform.rotation.eulerAngles.y;
        }

        PluginImport.UpdateHapticWorkspace(ConverterClass.ConvertFloatArrayToIntPtr(workspaceUpdateValue));

        /***************************************************************/
        //Update cube workspace
        /***************************************************************/
        myGenericFunctionsClassScript.UpdateGraphicalWorkspace();

        /***************************************************************/
        //Haptic Rendering Loop
        /***************************************************************/
        PluginImport.RenderHaptic();

        //Associate the cursor object with the haptic proxy value
        myGenericFunctionsClassScript.GetProxyValues();

        myGenericFunctionsClassScript.GetTouchedObject();

        Debug.Log("Button 1: " + PluginImport.GetButton1State());  // To be deprecated
        Debug.Log("Button 2: " + PluginImport.GetButton2State());  // To be deprecated

        Debug.Log("Device 1: Button 1: " + PluginImport.GetButtonState(1, 1));
        Debug.Log("Device 1: Button 2: " + PluginImport.GetButtonState(1, 2));

        //      if (PluginImport.GetButtonState(1, 2))
        //{
        //	makeJengaBlocks();
        //}

        if (PluginImport.GetButtonState(1, 1))
        {
            Debug.Log("Device 1 : Button Up Pressed");
        }
        else if (PluginImport.GetButtonState(1, 2))
        {
            Debug.Log("Device 1 : Button Down Pressed");
        }
        if (PluginImport.GetButtonState(2, 1))
        {
            Debug.Log("Device 2 : Button Up Pressed");
        }
        else if (PluginImport.GetButtonState(2, 2))
        {
            Debug.Log("Device 2 : Button Down Pressed");
        }


        const float rotSpeed = 1.0f;

        if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow))
        {
            myHapticCamera.transform.RotateAround(Vector3.zero, new Vector3(0.0f, 1.0f, 0.0f), rotSpeed);
        }
        if (Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow))
        {
            myHapticCamera.transform.RotateAround(Vector3.zero, new Vector3(0.0f, 1.0f, 0.0f), -rotSpeed);
        }
    }
Esempio n. 13
0
    void Update()
    {
        /////////////////////////////////// getting position of Haptic device ///////////////////////
        double[] pos = ConverterClass.ConvertIntPtrToDouble3(PluginImport.GetProxyPosition());
        //Vector3 position1 = new Vector3 ((float)pos [2], (float)pos [1], -(float)pos [0]);                   // applying rotation as device is rotated 90 degrees to left... swapping coordinates
        /////////////////////////////////////////////////////////////////////////////////////////////

        Vector3 position1 = new Vector3((float)pos [0], (float)pos [1], (float)pos [2]);

        position1 = rotation * position1;

        ///////////////////////////////// Instantiation of Targets as Key B is pressed + writing target coordinates to text file //////////////////////////

        button1 = PluginImport.GetButton1State();
        if (button1 && !previousbutton1stateI)
        {
            target [i] = Instantiate(ball);
            target [i].transform.position = new Vector3(i * 0.1f, j * 1.0f, -1.0f);

            using (StreamWriter writer = new StreamWriter("D:\\log.txt", true)) {
                writer.WriteLine("");
                writer.Write("Position for Target ");
                writer.Write(i + 1);
                writer.Write(" = ");
                writer.Write(target[i].transform.position);
            }

            if (i > 0)
            {
                Destroy(target [i - 1]);                    // destroying previous targets as the next target is displayed
            }
            i++;
            j = j + 0.1f;
        }

        previousbutton1stateI = button1;
        //////////////////////////////////////////////////////////////////////////////////////////////////////////



        button1 = PluginImport.GetButton1State();             // getting state of button 1 on phantom

        ///////////////////////////// routine for writing pointer current position to text file/////////////////////////////////////
        if (button1 && !previousbutton1state)
        {
            if (targetwritecounter > 0)
            {
                using (StreamWriter writer = new StreamWriter("D:\\log.txt", true)) {
                    writer.WriteLine("");
                    writer.Write("Hand position for target ");
                    writer.Write(targetwritecounter);
                    writer.Write(" = ");
                    writer.Write(gameObject.transform.position);
                }
            }

            targetwritecounter++;
        }

        previousbutton1state = button1;
        //////////////////////////////////////////////////////////////////////////////////////////////


        //////////////////////////////////// Controlling visibility of haptic sphere /////////////////

        if (Input.GetKeyDown(KeyCode.A))                                         // Controlling invisibility of the pointer object
        {
            visibility.GetComponent <MeshRenderer> ().enabled = false;           // making object invisible on pressing A
        }


        if (Input.GetKeyDown(KeyCode.S))
        {
            visibility.GetComponent <MeshRenderer> ().enabled = true;                           // Making object visible again on pressing S
        }
        //////////////////////////////////////////////////////////////////////////////////////////////



        ////////////////////////// Recentering of Head Set (Occulus)/////////////////////////////////////////
        if (Input.GetKeyDown(KeyCode.F12))
        {
            InputTracking.Recenter();
        }
        //////////////////////////////////////////////////////////////////////////////////////////////////////


        /***************************************************************/
        //Haptic Rendering Loop
        /***************************************************************/
        PluginImport.RenderHaptic();


        ///////////// Origin offset for phantom local coordinates/////////////////////
        position1 [0] = position1 [0] - (-0.2178f);
        position1 [1] = position1 [1] - (-0.8274f);
        position1 [2] = position1 [2] - (-0.0001f);
        ///////////////////////////////////////////////////////////////////////////////
        Debug.Log("Phantom Coordinates" + position1.ToString("F4"));

        ////////////////// scaling between real world distance and unity distance ///////////////

        position1 [0] = position1 [0] * 0.33f;                             //Real world 10cm = 30cm in unity      // scaling factor10/30
        position1 [1] = position1 [1] * 0.5882f;                           //Real world 10cm = 17cm in unity      // scaling factor10/17
        position1 [2] = position1 [2] * 0.625f;                            //Real world 10cm = 16cm in unity      // scaling factor10/16

        //////////////////////////////////////////////////////////////////////////////////////////

        //////////////// Linear transformation from phantom origin to occulus origin /////////////////
        //	position1 [0] = position1 [0]   + 0.006f+ 0.08f;
        position1 [1]      = position1 [1] + 0.63f;
        position1 [2]      = position1 [2] + 0.3f;
        transform.position = position1;
        //Debug.Log ("Phantom Coordinates" + position1.ToString ("F4"));

        //////////////////////////////////////////////////////////////////////////////////////////////



        ////////////////////////////// Printing Phantom coordinates to console //////////////////////

        //Debug.Log ("Phantom Coordinates" + position1.ToString ("F4"));

        //////////////////////////////////////////////////////////////////////////////////////////////

        //Debug.Log ("Button 1: " + PluginImport.GetButton1State());
        //Debug.Log ("Button 2: " + PluginImport.GetButton2State());
    }
Esempio n. 14
0
    void Update()
    {
        /***************************************************************/
        //Update Workspace as function of camera
        /***************************************************************/
        //PluginImport.UpdateWorkspace(myHapticCamera.transform.rotation.eulerAngles.y);//To be deprecated

        //Update the Workspace as function of camera
        for (int i = 0; i < workspaceUpdateValue.Length; i++)
        {
            workspaceUpdateValue[i] = myHapticCamera.transform.rotation.eulerAngles.y;
        }

        PluginImport.UpdateHapticWorkspace(ConverterClass.ConvertFloatArrayToIntPtr(workspaceUpdateValue));

        /***************************************************************/
        //Update cube workspace
        /***************************************************************/
        myGenericFunctionsClassScript.UpdateGraphicalWorkspace();

        /***************************************************************/
        //Haptic Rendering Loop
        /***************************************************************/
        PluginImport.RenderHaptic();

        //Associate the cursor object with the haptic proxy value
        myGenericFunctionsClassScript.GetProxyValues();

        //For the Puncture Mode effect
        if (PluginImport.GetMode() == 3)
        {
            //Debug.Log ("Contact state is set to " + PluginImport.GetContact());
            //Debug.Log ("Penetration State " + PluginImport.GetPenetrationRatio());

            double[] myScp = new double[3];
            myScp = ConverterClass.ConvertIntPtrToDouble3(PluginImport.GetFirstScpPt());
            //Debug.Log (" SCP " + myScp[0] + " " + myScp[1] + " " + myScp[2]);

            Vector3 posInjectionHole;
            posInjectionHole = ConverterClass.ConvertDouble3ToVector3(myScp);
            GameObject.Find("InjectionMarker").transform.position = posInjectionHole;

            /*double[] myProx = new double[3];
             * myProx = ConverterClass.ConvertIntPtrToDouble3(PluginImport.GetProxyPosition());
             *
             * Vector3 posProx;
             * posProx = ConverterClass.ConvertDouble3ToVector3(myProx);
             * GameObject.Find ("ProxyTipMarker").transform.position = posProx;*/

            /*double[] myDev = new double[3];
             * myDev = ConverterClass.ConvertIntPtrToDouble3(PluginImport.GetDevicePosition());
             *
             * Vector3 posDevice;
             * posDevice = ConverterClass.ConvertDouble3ToVector3(myDev);
             * GameObject.Find ("DeviceTipMarker").transform.position = posDevice;*/

            double[] myPinch = new double[3];
            myPinch = ConverterClass.ConvertIntPtrToDouble3(PluginImport.GetPunctureDirection());

            Vector3 start = new Vector3();
            start = ConverterClass.ConvertDouble3ToVector3(myScp);
            Vector3 end = new Vector3();
            end = ConverterClass.ConvertDouble3ToVector3(myPinch);
            end.Normalize();

            Debug.DrawLine(start, start + end * maxPenetration, Color.green);

            //Ray Cast so we can determine the limitation of the puncture
            RaycastHit[] hits;
            hits = Physics.RaycastAll(start, end, maxPenetration);

            if (hits.Length != 0)
            {
                //Declare a float array to store the tissue layer
                float[] tissueLayers = new float[hits.Length];
                //Declare a string array to store the name of the tissue layer
                string[] punctObjects = new string[hits.Length];
                int      nbLayer      = 0;

                for (int i = 0; i < hits.Length; i++)
                {
                    RaycastHit hit = hits[i];

                    //Only if the object is declared as touchable
                    if (hit.collider.gameObject.tag == "Touchable")
                    {
                        tissueLayers[nbLayer] = hit.distance;
                        punctObjects[nbLayer] = hit.collider.name;
                        nbLayer++;
                    }
                }

                /*Declaration of the Puncture Stack
                 * Additionally, on the basis of the puncture stack components, the plugin setup a penetration restriction
                 * - due to the fact that Proxy Method along such constraint line is not accurate - most probably due to the fact
                 * that device position and proxy position differ because the constraint applies forces onto the device.
                 * So, the plugin impedes the proxy to penetrate in underlying layer when their popthrough values is null
                 */
                SetPunctureStack(nbLayer, punctObjects, tissueLayers);
            }
        }
    }
    void Update()
    {
        /*if (PluginImport.GetButtonState(1, 1) && isKinematic)
         * {
         *  Debug.Log("Inside button press");
         *  isKinematic = !isKinematic;
         *
         *  GameObject[] capsules = GameObject.FindGameObjectsWithTag("ElectrodeCapsule");
         *
         *  foreach (GameObject go in capsules)
         *  {
         *      Rigidbody goRB = go.GetComponent<Rigidbody>();
         *      goRB.isKinematic = false;
         *  }
         * }*/

        if (PluginImport.GetButtonState(1, 2))
        {
            SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
        }

        /*if (PluginImport.GetButtonState(1, 1))
         * {
         *  isKinematic = !isKinematic;
         *
         *  GameObject[] capsules = GameObject.FindGameObjectsWithTag("ElectrodeCapsule");
         *
         *  foreach (GameObject go in capsules)
         *  {
         *      Rigidbody goRB = go.GetComponent<Rigidbody>();
         *      goRB.isKinematic = false;
         *  }
         * }*/


        /***************************************************************/
        //Update Workspace as function of camera
        /***************************************************************/
        //PluginImport.UpdateWorkspace(myHapticCamera.transform.rotation.eulerAngles.y);//To be deprecated

        //Update the Workspace as function of camera
        //for (int i = 0; i < workspaceUpdateValue.Length; i++)
        //workspaceUpdateValue[i] = myHapticCamera.transform.rotation.eulerAngles.y;

        //PluginImport.UpdateHapticWorkspace(ConverterClass.ConvertFloatArrayToIntPtr(workspaceUpdateValue));

        /***************************************************************/
        //Update cube workspace
        /***************************************************************/
        myGenericFunctionsClassScript.UpdateGraphicalWorkspace();

        /***************************************************************/
        //Haptic Rendering Loop
        /***************************************************************/
        PluginImport.RenderHaptic();

        //Associate the cursor object with the haptic proxy value
        myGenericFunctionsClassScript.GetProxyValues(isKinematic);
        //myGenericFunctionsClassScript.GetProxyValues();

        /*if (isKinematic)
         * {
         *  GameObject[] capsules = GameObject.FindGameObjectsWithTag("ElectrodeCapsule");
         *
         *  foreach (GameObject go in capsules)
         *  {
         *      Rigidbody goRB = go.GetComponent<Rigidbody>();
         *      goRB.constraints = RigidbodyConstraints.None;
         *  }
         *  isKinematic = false;
         * }*/


        //Vector3 pos = ConverterClass.ConvertDouble3ToVector3(ConverterClass.ConvertIntPtrToDouble3(PluginImport.GetProxyPosition()));
        //Vector3 movement = (rb.position - pos).normalized;
        //rb.MovePosition(rb.position + movement * Time.deltaTime);
        //hapticCursor.transform.position = pos;
        //myGenericFunctionsClassScript.GetTouchedObject();

        //Reset the writing on the board
        //if(ConverterClass.ConvertIntPtrToByteToString( PluginImport.GetTouchedObjectName()) == "reset") // GetTouchedObjectName - To be deprecated
        //if (ConverterClass.ConvertIntPtrToByteToString(PluginImport.GetTouchedObjName(1)) == "reset")
        //{
        //myWritingScript.cleanBoard();

        //Change the Color of the button material
        //myResetButton.GetComponent<Renderer>().material.color = buttonResetColors[1];
        //}
        //else
        //myResetButton.GetComponent<Renderer>().material.color = buttonResetColors[0];
    }