Example #1
0
 void SpawnBullet()
 {
     preBullet.AddForce(-barrel.transform.forward * bulletSpeed);
     bulletController.setIdx((int)(this.transform.position.y / 12.5f));
     //Debug.Log((int)(preBullet.transform.position.y / 12.5f));
     preBullet        = Instantiate(bullet, new Vector3(barrel.position.x, barrel.position.y, barrel.position.z), barrel.rotation) as Rigidbody;
     bulletController = preBullet.gameObject.GetComponent <bulletController>();
     //b.AddForce(b.transform.forward * bulletSpeed);
     oscSender.sendMessage("/fire/ " + 1);
     shootTime = Time.time;
 }