// Pedal Movement
    // 실질적으로 움직이는건 상위 객체 Only, 회전은 상위 객체 & 하위 콕핏 (기체 회전시 영점 뒤틀림 보정)
    private void MovePosition()
    {
        float left = 0, right = 0, side = 0;

        //  rotationobj.transform.rotation = Quaternion.Euler(cam.transform.rotation * Vector3.forward);


        rightPedalmoveY = controller.getAxisValue(ControllerVec2Axes.RStick).y;
        leftPedalmoveX  = controller.getAxisValue(ControllerVec2Axes.RStick).x;

        PedalZ = controller.data.axesValues[4];

        horizon  = Input.GetAxisRaw("JoyHorizontal");
        vertical = Input.GetAxisRaw("JoyVertical");


        if (bIsRightPedal == false && bIsLeftPedal == false)
        {
            switch (controller.data.hatSwitch)
            {
            case 2:
            case 3:
            case 4:
            case 5:
                if (bIsRightblockHit == false)
                {
                    if (renderedRoll <= 200)
                    {
                        renderedRoll += 2;
                    }
                    MoveFoward(vertical, horizon, false, true, false);
                }

                break;

            case 1:
            case 6:
            case 7:
            case 8:
                if (bIsLeftblockHit == false)
                {
                    if (renderedRoll >= -200)
                    {
                        renderedRoll -= 2;
                    }
                    horizon *= -1;
                    MoveFoward(vertical, horizon, false, true, false);
                }

                break;

            default:

                break;
            }
        }

        Thread1_UpdateObject(PedalZ, left, right, side);
    }
Exemple #2
0
    // Update is called once per frame
    void Update()
    {
        //get the controller from the index
        JInput.Controller controller = JInput.InputManager.getController(m_ControllerIndex);

        //controller can be null
        if (controller == null)
        {
            return;
        }

        //get axis
        Vector2 axisVec;

        //axisVec.x = controller.getAxisValue(JInput.ControllerAxes.LStickX);
        //axisVec.y = controller.getAxisValue(JInput.ControllerAxes.LStickY);
        axisVec = controller.getAxisValue(m_Axis);

        //axis values are backwards from what we want
        axisVec = -axisVec;

        //rotate the transform
        transform.Rotate(new Vector3(axisVec.y, axisVec.x, 0) * m_Speed, Space.World);

        if (m_PrintInfoToConsole)
        {
            print(m_ControllerIndex + " - " + m_Axis.ToString() + " - (" + axisVec.x + "," + axisVec.y + ")");
        }
    }