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);//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));

            //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();
        }
        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
        //And read haptic characteristics
        /***************************************************************/
        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();
    }
    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);//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));

            //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 touchable face(s)
            PluginImport.SetTouchableFace(ConverterClass.ConvertStringToByteToIntPtr(TouchableFace));
        }
        else
        {
            Debug.Log("Haptic Device cannot be launched");
        }

        /***************************************************************/
        //Set Environmental Haptic Effect
        /***************************************************************/
        // Viscous Force Example
        myGenericFunctionsClassScript.SetEnvironmentViscosity();

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

        //Custom Force Effect Vibration Motor
        myGenericFunctionsClassScript.SetVibrationMotor();

        //Custom Force Effect Vibration at Contact//Good for p1ulsation
        myGenericFunctionsClassScript.SetVibrationContact();

        //Custom Tangential Force corresponding to that of a rotating power tool (e.g. Drill, Polisher, Grinder)
        // if tool is angled set direction to 0,1,0 otherwise it does not matter (Tool will be straight)
        myGenericFunctionsClassScript.SetTangentialForce();


        /***************************************************************/
        //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();
    }
    void Start()
    {
        blocks = new GameObject[height * 3];
        makeJengaBlocks();

        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();
        }
        else
        {
            Debug.Log("Haptic Device cannot be launched");
        }

        /***************************************************************/
        //Set Environmental Haptic Effect
        /***************************************************************/
        // Viscous Force Example
        myGenericFunctionsClassScript.SetEnvironmentViscosity();

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

        // Friction Force Example
        //myGenericFunctionsClassScript.SetEnvironmentFriction();

        // Spring Force Example
        //myGenericFunctionsClassScript.SetEnvironmentSpring();


        /***************************************************************/
        //Setup the Haptic Geometry in the OpenGL context
        //And read haptic characteristics
        /***************************************************************/
        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. 4
0
    void Start()
    {
        blocks = new GameObject[height * 3];
        if (jenga)
        {
            makeJengaBlocks();
        }
        else
        {
            for (int i = 0; i < 5; i++)
            {
                float antX = init.transform.position.x;
                float antY = init.transform.position.y;
                float antZ = init.transform.position.z;
                init.transform.position = new Vector3(antX + 1.1f, antY + 0.4f, antZ);
                generarBloques();
            }


            Invoke("quitarPiso", time);
        }

        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);  //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));

            //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 touchable face(s)
            PluginImport.SetTouchableFace(ConverterClass.ConvertStringToByteToIntPtr(TouchableFace));
        }
        else
        {
            Debug.Log("Haptic Device cannot be launched");
        }

        /***************************************************************/
        //Set Environmental Haptic Effect
        /***************************************************************/
        // Viscous Force Example
        myGenericFunctionsClassScript.SetEnvironmentViscosity();

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

        // Friction Force Example
        //myGenericFunctionsClassScript.SetEnvironmentFriction();

        // Spring Force Example
        //myGenericFunctionsClassScript.SetEnvironmentSpring();


        /***************************************************************/
        //Setup the Haptic Geometry in the OpenGL context
        //And read haptic characteristics
        /***************************************************************/
        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();
    }