// Update is called once per frame void Update() { float randomFirerate = Random.Range(0.0f, 1000.0f); if (randomFirerate < firerate) { // Get random point Vector3 randomShot = getShotPoint(); // Check shot integrity bool shallShot = getIntegrity(randomShot); if (shallShot) { gun.Fire3d(bullet, bulletSpawn, randomShot, speed); } } }
// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { //create a ray cast and set it to the mouses cursor position in game Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, float.PositiveInfinity)) { //draw invisible ray cast/vector Debug.DrawLine(ray.origin, hit.point); //log hit area to the console // Debug.Log(hit.point); gun.Fire3d(bullet, bulletSpawn, hit.point, speed); } } if (Input.GetButtonDown("Fire1")) { mover.move("clockwise"); } }