void Update() { if (holdingBall) { ball.transform.position = playerCamera.transform.position + playerCamera.transform.forward * ballDistance; if (Input.GetMouseButtonDown(0)) { holdingBall = false; ball.ActiveTrail(); ball.GetComponent <Rigidbody>().useGravity = true; ball.GetComponent <Rigidbody>().AddForce(playerCamera.transform.forward * ballThrowingForce); } } }
// Update is called once per frame void Update() { //when player look around ball right in front of player //both of these are Vector 3 col of 3three elements hor,ver,depth pos //forward referencing direction ... ima i up,down,left,right //referencing point in the world if (holdingBall) { ball.transform.position = playerCamera.transform.position + playerCamera.transform.forward * ballDistance; if (Input.GetMouseButtonDown(0)) { holdingBall = false; //graviti needs to be reaplied to ball //ovo se doda kad se napravi ball scirpt pa kad je bacis da prsti perje ball.ActiveTrail(); ball.GetComponent <Rigidbody>().useGravity = true; ball.GetComponent <Rigidbody>().AddForce(playerCamera.transform.forward * ballThrowingForce); } } // ball.transform.position = playerCamera.transform.position + playerCamera.transform.forward* ballDistance; }