예제 #1
0
 void setIntPtr()
 {
     //convert String to IntPtr
     _type = ConverterClass.ConvertStringToByteToIntPtr(Type);
     //Convert float[3] to intptr
     _position = ConverterClass.ConvertFloat3ToIntPtr(positionEffect);
     //Convert float[3] to intptr
     _direction = ConverterClass.ConvertFloat3ToIntPtr(directionEffect);
 }
예제 #2
0
    public static void SetEnvironmentForce(string nType, int index, float[] positionEffect, float[] directionEffect, float gain, float magnitude, float duration, float frequency)
    {
        //convert String to IntPtr
        IntPtr type = ConverterClass.ConvertStringToByteToIntPtr(nType);
        //Convert float[3] to intptr
        IntPtr position = ConverterClass.ConvertFloat3ToIntPtr(positionEffect);
        //Convert float[3] to intptr
        IntPtr direction = ConverterClass.ConvertFloat3ToIntPtr(directionEffect);

        //Set the effect
        PluginImport.SetEffect(type, index, gain, magnitude, duration, frequency, position, direction);
        PluginImport.StartEffect(index);
    }
    /******************************************************************************************************************************************************************/

    //Haptic workspace generic functions
    public void SetHapticWorkSpace()
    {
        //Convert float3Array to IntPtr
        IntPtr dstPosPtr = ConverterClass.ConvertFloat3ToIntPtr(myHapticClassScript.myWorkSpacePosition);

        //Convert float3Array to IntPtr
        IntPtr dstSizePtr = ConverterClass.ConvertFloat3ToIntPtr(myHapticClassScript.myWorkSpaceSize);

        //Set Haptic Workspace for separate update
        //PluginImport.SetWorkspacePosition(dstPosPtr);
        //PluginImport.SetWorkspaceSize(dstSizePtr);

        //Set Haptic Workspace
        PluginImport.SetWorkspace(dstPosPtr, dstSizePtr);
    }
    public void SetTangentialForce()
    {
        myTangentialForceScript = transform.GetComponent <TangentialForce>();

        /*****************************
        * Tangential Force Example
        *****************************/
        //convert String to IntPtr
        IntPtr type = ConverterClass.ConvertStringToByteToIntPtr(myTangentialForceScript.Type);
        //Convert float[3] to intptr
        IntPtr position = ConverterClass.ConvertFloat3ToIntPtr(myTangentialForceScript.positionEffect);
        //Convert float[3] to intptr
        IntPtr direction = ConverterClass.ConvertFloat3ToIntPtr(myTangentialForceScript.directionEffect);

        //Set the effect
        PluginImport.SetEffect(type, myTangentialForceScript.effect_index, myTangentialForceScript.gain, myTangentialForceScript.magnitude, myTangentialForceScript.duration, myTangentialForceScript.frequency, position, direction);
        PluginImport.StartEffect(myTangentialForceScript.effect_index);
    }
    /******************************************************************************************************************************************************************/

    //Haptic Effects generic functions
    public void SetEnvironmentViscosity()
    {
        //Get data from script
        myViscosityScript = transform.GetComponent <ViscosityEffect>();


        /*****************************
        * Viscous Force Example
        *****************************/
        //convert String to IntPtr
        IntPtr type = ConverterClass.ConvertStringToByteToIntPtr(myViscosityScript.Type);
        //Convert float[3] to intptr
        IntPtr position = ConverterClass.ConvertFloat3ToIntPtr(myViscosityScript.positionEffect);
        //Convert float[3] to intptr
        IntPtr direction = ConverterClass.ConvertFloat3ToIntPtr(myViscosityScript.directionEffect);

        //Set the effect
        PluginImport.SetEffect(type, myViscosityScript.effect_index, myViscosityScript.gain, myViscosityScript.magnitude, myViscosityScript.duration, myViscosityScript.frequency, position, direction);
        PluginImport.StartEffect(myViscosityScript.effect_index);
    }