示例#1
0
    // Update is called once per frame
    void Update()
    {
        if (saiu)
        {
            bola.objetoTrilha.SetActive(false);
            segurandoBola = true;
            bola.GetComponent <Rigidbody>().useGravity = false;
            saiu = false;
        }

        if (segurandoBola)
        {
            bola.transform.position = playerCamera.transform.position + playerCamera.transform.forward * distanciaBola;
            if (Input.GetMouseButton(0))
            {
                if (forcaArremesso < 1000)
                {
                    forcaArremesso += 15;
                    Debug.Log(forcaArremesso);
                }
            }

            if (Input.GetMouseButtonUp(0))
            {
                bola.ParaRotacao();
                bola.AtivarTrilha();
                segurandoBola = false;
                bola.GetComponent <Rigidbody>().useGravity = true;
                bola.GetComponent <Rigidbody>().AddForce(playerCamera.transform.forward * forcaArremesso);
                forcaArremesso = 0;
            }
        }
    }