Esempio n. 1
0
    void Start()
    {
        if (PluginImport.InitHapticDevice())
        {
            Debug.Log("OpenGL Context Launched");
            Debug.Log("Haptic Device Launched");

            myGenericFunctionsClassScript.SetHapticWorkSpace();
            myGenericFunctionsClassScript.GetHapticWorkSpace();

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

            //Set Mode of Interaction

            /*
             * Mode = 0 Contact
             * Mode = 1 Manipulation - So objects will have a mass when handling them
             * Mode = 2 Custom Effect - So the haptic device simulate vibration and tangential forces as power tools
             * Mode = 3 Puncture - So the haptic device is a needle that puncture inside a geometry
             */
            PluginImport.SetMode(ModeIndex);
            //Show a text descrition of the mode
            myGenericFunctionsClassScript.IndicateMode();

            //Set the lenght of the syringue needle to penetrate inside the tissue
            PluginImport.SetMaximumPunctureLenght(maxPenetration);

            //Set the touchable face(s)
            PluginImport.SetTouchableFace(ConverterClass.ConvertStringToByteToIntPtr(TouchableFace));
        }
        else
        {
            Debug.Log("Haptic Device cannot be launched");
        }


        /***************************************************************/
        //Set Environmental Haptic Effect
        /***************************************************************/

        // Constant Force Example - We use this environmental force effect to simulate the weight of the cursor
        //myGenericFunctionsClassScript.SetEnvironmentConstantForce();

        /***************************************************************/
        //Setup the Haptic Geometry in the OpenGL context
        /***************************************************************/
        myGenericFunctionsClassScript.SetHapticGeometry();

        //Get the Number of Haptic Object
        //Debug.Log ("Total Number of Haptic Objects: " + PluginImport.GetHapticObjectCount());

        /***************************************************************/
        //Launch the Haptic Event for all different haptic objects
        /***************************************************************/
        PluginImport.LaunchHapticEvent();
    }
Esempio n. 2
0
    void Start()
    {
        if (PluginImport.InitHapticDevice())
        {
            Debug.Log("OpenGL Context Launched");
            Debug.Log("Haptic Device Launched");

            myGenericFunctionsClassScript.SetHapticWorkSpace();
            myGenericFunctionsClassScript.GetHapticWorkSpace();

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

            //Set Mode of Interaction

            /*
             * Mode = 0 Contact
             * Mode = 1 Manipulation - So objects will have a mass when handling them
             * Mode = 2 Custom Effect - So the haptic device simulate vibration and tangential forces as power tools
             * Mode = 3 Puncture - So the haptic device is a needle that puncture inside a geometry
             */
            PluginImport.SetMode(3);
            //Show a text descrition of the mode
            myGenericFunctionsClassScript.IndicateMode();

            //Define a Penetration direction Vector - useful for brain biopsy for instance.
            //For realism, the orientation of the needle will need to be detached from that of the haptic device
            //The new orientation on local Z of the needle will be that indicated by the vector set below.

            /*double[] injectionDir = new double[3]{0.0f,0.0f,1.0f};
             * PluginImport.SetPunctureDirection(ConverterClass.ConvertDouble3ToIntPtr(injectionDir));*/

            //Set the lenght of the syringue needle to penetrate inside the tissue
            PluginImport.SetMaximumPunctureLenght(maxPenetration);

            //Set the touchable face(s)
            PluginImport.SetTouchableFace(ConverterClass.ConvertStringToByteToIntPtr(TouchableFace));
        }
        else
        {
            Debug.Log("Haptic Device cannot be launched");
        }


        /***************************************************************/
        //Set Environmental Haptic Effect
        /***************************************************************/

        // Constant Force Example - We use this environmental force effect to simulate the weight of the cursor
        //myGenericFunctionsClassScript.SetEnvironmentConstantForce();

        /***************************************************************/
        //Setup the Haptic Geometry in the OpenGL context
        /***************************************************************/
        myGenericFunctionsClassScript.SetHapticGeometry();

        //Get the Number of Haptic Object
        //Debug.Log ("Total Number of Haptic Objects: " + PluginImport.GetHapticObjectCount());

        /***************************************************************/
        //Launch the Haptic Event for all different haptic objects
        /***************************************************************/
        PluginImport.LaunchHapticEvent();
    }