i am using some scripts that i found that make it so I can shoot. It uses a variable that is the ball, and it spawns it to the empty gameobject that shoots it. here is the website I got it from: MEGA (you will have to sign in, i just used blur for fake account though) it lets me shoot, but in the files it gives me two choices: either gives me a certain amount of time I can keep the bullet and it will destroy all the clones with it, or it will keep all the clones and keep the bullet. for ease of use, here is the shoot program that makes the clones:
static var ammo = 100;
static var maxAmmo = 100;
var key : String = “mouse 0”;
var bullet : Rigidbody;
var speed : float = 1000;
function Update () {
if(Input.GetKeyDown(key)){
if(ammo > 0){
shoot();
}
}
}
function shoot(){
var bullet1 : Rigidbody = Instantiate(bullet, transform.position, transform.rotation);
bullet1.AddForce(transform.forward * speed);
ammo --;
}
I need a way to destroy the clones and keep the main bullet. thanks!