Exemple #1
0
 // Update is called once per frame
 void Update()
 {
     if (holdingBall)
     {
         ball.transform.position = playerCamera.transform.position + playerCamera.transform.forward * ballDistance;
         if (Input.GetMouseButton(0))
         {
             ballThrowingForce += Time.deltaTime * 10;
         }
         if (Input.GetMouseButtonUp(0))
         {
             holdingBall = false;
             ball.ActivateTrial();
             ball.GetComponent <Rigidbody>().useGravity = true;
             ball.GetComponent <Rigidbody>().AddForce(playerCamera.transform.forward * ballThrowingForce);
         }
     }
     if (PlayerReset == 1)
     {
         Reset();
         PlayerReset = 0;
     }
 }