private void PortInputUpdate(TGInputSetting input)
    {
        var target = new Vector3();

        string strOrder = axisOrder.ToString().ToLower();

        if (input.DeviceType == "m7b" || input.DeviceType == "m7b2D")
        {
            target = input.GetValueFromEvalAxis();
        }
        else
        {
            target = input.GetValues();
        }

        target = target.Reorder(strOrder);

        target.x = Mathf.Clamp01(target.x);
        target.y = Mathf.Clamp01(target.y);
        target.z = Mathf.Clamp01(target.z);

        if (reverseX)
        {
            target.x = 1.0f - target.x;
        }

        if (reverseY)
        {
            target.y = 1.0f - target.y;
        }

        m_input.x = Mathf.Lerp(m_input.x, target.x, damp);
        m_input.y = Mathf.Lerp(m_input.y, target.y, damp);
        m_input.z = Mathf.Lerp(m_input.z, target.z, damp);

        // TGController.Instance.WriteLine("Input After: " + m_input.ToString());

        m_playerCtrl.MoveByPort(m_input);
    }
Beispiel #2
0
    private void PortInputUpdate()
    {
        var target = new Vector3();

        string strOrder = axisOrder.ToString().ToLower();

        if (TGData.DeviceType == "m7b" || TGData.DeviceType == "m7b2D")
        {
            target = TGInputSetting.GetValueFromEvalAxis();
        }
        else
        {
            target = TGInputSetting.GetValues();
        }

        target = target.Reorder(strOrder);

        target.x = Mathf.Clamp01(target.x);
        target.y = Mathf.Clamp01(target.y);
        target.z = Mathf.Clamp01(target.z);

        if (reverseX)
        {
            target.x = 1.0f - target.x;
        }

        if (reverseY)
        {
            target.y = 1.0f - target.y;
        }

        m_input.x = Mathf.Lerp(m_input.x, target.x, damp);
        m_input.y = Mathf.Lerp(m_input.y, target.y, damp);
        m_input.z = Mathf.Lerp(m_input.z, target.z, damp);

        m_playerCtrl.MoveByPort(m_input);
    }