devNotes 12-08-2016 Teleportation – Segment 3

Versor_action_on_Hurwitz_quaternions.svg

   void Update()//positive - 60 to left - 360  300 to the right
    {
        if (bFineTuner_On && bGripPressed)
        {
            vEuler = transform.localRotation.eulerAngles;
            vEuler.x = 0;
            vEuler.y = 0;

            float val = vEuler.z;

            if (val > 60f && val < 180f) val = 60f;
            if (val < 300f && val > 180f) val = 300f;
            float setVal = val;

            if (val < 300f)//60 range
            {
                val = -(val / 60f);
            }
            else
            {
                val = (360f - val) / 60f;
            }
            lastVal = val;
            throttle_Value = val;

            UI_Ladder.Instance.Set_FineTune_Val(throttle_Value);

            ushort aPulse = (ushort)(Mathf.Abs(throttle_Value * throttle_Value * 800));
            GetComponent<VRTK_ControllerActions>().TriggerHapticPulse(aPulse);
            bReturn = false;
        }
        else
        {
            UI_Ladder.Instance.Set_FineTune_Val(0);
        }
    }
}

 

005g