Exemple #1
0
    void FixedUpdate()
    {
        float lateral, vertical;

        if (Input.GetButton("Fire"))
        {
            shipMotor.setThrust(1f);
        }
        else
        {
            shipMotor.setThrust(0.5f);
        }


        if (useClassicControls || tiltJoystick == null || !tiltJoystick.enabled)
        {
            vertical = Input.GetAxis("Vertical");
            lateral  = Input.GetAxis("Horizontal");
        }
        else
        {
            vertical = tiltJoystick.getPitch();
            lateral  = tiltJoystick.getRoll();
        }

        shipMotor.setPitchAngle(vertical);
        shipMotor.setTurnAmount(lateral);
    }