/******************************************************************************************************************************************************************/

    //Get Proxy Position and Orientation generic function
    public void GetProxyValues()
    {
        /*Proxy Position*/

        //Convert IntPtr to Double3Array
        myProxyPosition = ConverterClass.ConvertIntPtrToDouble3(PluginImport.GetProxyPosition());

        //Attach the Cursor Node
        Vector3 positionCursor = new Vector3();

        positionCursor = ConverterClass.ConvertDouble3ToVector3(myProxyPosition);

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


        //Proxy Right - Not use in that case
        //Convert IntPtr to Double3Array

        /*myProxyRight =  ConverterClass.ConvertIntPtrToDouble3(PluginImport.GetProxyRight());
         * //Attach the Cursor Node
         * Vector3 rightCursor = new Vector3();
         * rightCursor = ConverterClass.ConvertDouble3ToVector3(myProxyRight);
         *
         * //Proxy Direction
         * //Convert IntPtr to Double3Array
         * myProxyDirection =  ConverterClass.ConvertIntPtrToDouble3( PluginImport.GetProxyDirection());
         * //Attach the Cursor Node
         * Vector3 directionCursor = new Vector3();
         * directionCursor = ConverterClass.ConvertDouble3ToVector3(myProxyDirection);
         *
         * //Proxy Torque
         * myProxyTorque = ConverterClass.ConvertIntPtrToDouble3(PluginImport.GetProxyTorque());
         * //Attach the Cursor Node
         * Vector3 torqueCursor = new Vector3();
         * torqueCursor = ConverterClass.ConvertDouble3ToVector3(myProxyTorque);
         *
         * //Set Orientation
         * myHapticClassScript.hapticCursor.transform.rotation = Quaternion.LookRotation(directionCursor,torqueCursor);*/

        //Proxy Orientation
        //Convert IntPtr to Double4Array
        myProxyOrientation = ConverterClass.ConvertIntPtrToDouble4(PluginImport.GetProxyOrientation());

        //Attach the Cursor Node
        Vector4 OrientationCursor = new Vector4();

        OrientationCursor = ConverterClass.ConvertDouble4ToVector4(myProxyOrientation);

        //Assign Haptic Values to Cursor
        myHapticClassScript.hapticCursor.transform.rotation = new Quaternion(OrientationCursor.x, OrientationCursor.y, OrientationCursor.z, OrientationCursor.w);
    }
Example #2
0
    /******************************************************************************************************************************************************************/

    public void GetProxyValues()
    {
        //Convert IntPtr to Double3Array
        myProxyPosition = ConverterClass.ConvertIntPtrToDouble3(PluginImport.GetProxyPosition());

        //Attach the Cursor Node
        Vector3 positionCursor = new Vector3();

        positionCursor = ConverterClass.ConvertDouble3ToVector3(myProxyPosition);

        positionCursor.z *= 2f;

        myHapticClassScript.hapticCursor.transform.position = positionCursor;

        myProxyOrientation = ConverterClass.ConvertIntPtrToDouble4(PluginImport.GetProxyOrientation());

        //Attach the Cursor Node
        Vector4 OrientationCursor = new Vector4();

        OrientationCursor = ConverterClass.ConvertDouble4ToVector4(myProxyOrientation);

        //Assign Haptic Values to Cursor
        myHapticClassScript.hapticCursor.transform.rotation = new Quaternion(OrientationCursor.x, OrientationCursor.y, OrientationCursor.z, OrientationCursor.w);
    }
Example #3
0
    //Get Proxy Position and Orientation generic function
    public void GetProxyValues(bool useTransform)
    {
        /*Proxy Position*/

        //Convert IntPtr to Double3Array
        myProxyPosition = ConverterClass.ConvertIntPtrToDouble3(PluginImport.GetProxyPosition());

        //Attach the Cursor Node
        Vector3 positionCursor = new Vector3();

        positionCursor = ConverterClass.ConvertDouble3ToVector3(myProxyPosition);


        positionCursor.z *= 2f;

        //Vector3 movement = positionCursor - rb.position;

        if (useTransform)
        {
            myHapticClassScript.hapticCursor.transform.position = positionCursor;
        }
        else
        {
            rb.MovePosition(positionCursor);
        }

        //myHapticClassScript.hapticCursor.transform.position = positionCursor;



        /*
         * if (movement.magnitude > 0.1)
         * {
         *  positionCursor = myHapticClassScript.hapticCursor.transform.position;//movement.normalized * 0.01f + myHapticClassScript.hapticCursor.transform.position;
         * }*/

        //rb.velocity = new Vector3(0,0,0);
        //if (movement.magnitude > 0.1)
        //rb.velocity = movement * Time.deltaTime * 500;
        //rb.AddForce(movement);

        //else rb.velocity = new Vector3(0, 0, 0);

        //rb.MovePosition(positionCursor);
        //rb.position = positionCursor;
        //rb.MovePosition(positionCursor*2);
        //myHapticClassScript.hapticCursor.gameObject.GetComponent<Rigidbody>().MovePosition(positionCursor);
        //rb.AddForce((rb.gameObject.transform.position - positionCursor) * 5, ForceMode.VelocityChange);

        //Proxy Right - Not use in that case
        //Convert IntPtr to Double3Array

        /*myProxyRight =  ConverterClass.ConvertIntPtrToDouble3(PluginImport.GetProxyRight());
         *      //Attach the Cursor Node
         *      Vector3 rightCursor = new Vector3();
         *      rightCursor = ConverterClass.ConvertDouble3ToVector3(myProxyRight);
         *
         *      //Proxy Direction
         *      //Convert IntPtr to Double3Array
         *      myProxyDirection =  ConverterClass.ConvertIntPtrToDouble3( PluginImport.GetProxyDirection());
         *      //Attach the Cursor Node
         *      Vector3 directionCursor = new Vector3();
         *      directionCursor = ConverterClass.ConvertDouble3ToVector3(myProxyDirection);
         *
         *      //Proxy Torque
         *      myProxyTorque = ConverterClass.ConvertIntPtrToDouble3(PluginImport.GetProxyTorque());
         *      //Attach the Cursor Node
         *      Vector3 torqueCursor = new Vector3();
         *      torqueCursor = ConverterClass.ConvertDouble3ToVector3(myProxyTorque);
         *
         *      //Set Orientation
         *      myHapticClassScript.hapticCursor.transform.rotation = Quaternion.LookRotation(directionCursor,torqueCursor);*/

        //Proxy Orientation
        //Convert IntPtr to Double4Array
        myProxyOrientation = ConverterClass.ConvertIntPtrToDouble4(PluginImport.GetProxyOrientation());

        //Attach the Cursor Node
        Vector4 OrientationCursor = new Vector4();

        OrientationCursor = ConverterClass.ConvertDouble4ToVector4(myProxyOrientation);

        //Assign Haptic Values to Cursor
        if (useTransform)
        {
            myHapticClassScript.hapticCursor.transform.rotation = new Quaternion(OrientationCursor.x, OrientationCursor.y, OrientationCursor.z, OrientationCursor.w);
        }
        else
        {
            rb.MoveRotation(new Quaternion(OrientationCursor.x, OrientationCursor.y, OrientationCursor.z, OrientationCursor.w));
        }
    }