- Home /
 
rapid movement back and forth
does any1 know how to make a child object move back and forth with a speed and frequency acroding to a fire rate?
               Comment
              
 
               
              if(Input.GetButton ("Fire1") && Time.time > nextFire){
        nextFire = Time.time + fireRate; 
        Instantiate(bullet, spawn.position, spawn.rotation);     effect.renderer.enabled=true; 
        clip = clip - 1;  
        shots++;
 
        transform.position.z += 5;
 
        }else{
 
           effect.renderer.enabled=false; 
           transform.position.z -= 5;
 
        } 
 
                  i want to make it so that every time it fires a bullet it makes the gun object move forward, and everytime it's not firing i want the gun to go back to it's original position
Answer by Dave 11 · May 10, 2011 at 01:01 PM
I'm not sure what you want to do, but try to attach it to the bullet.
Your answer