Firing at a target

I'm making a catapult game, and I want to be able to fire a projectile at a selected area. These are my scripts --- what do I need to do? On camera :

function Update () {
        var horiz : float = Input.GetAxis("Horizontal");

On Projectile maker (child of camera)

var projectile : GameObject;
var ammo : float = 1;

function Update (){
if(Input.GetButtonUp("Jump") && ammo >0){
print ("New projectile!");
 var instance : GameObject = Instantiate(projectile, transform.position, transform.rotation);


And on projectile collsion:

var explosion : GameObject;

function OnCollisionEnter(theCollision : Collision){
 if( == "Cube"){
 Destroy(gameObject.Find("projectile"), 0);
 var instance : GameObject = Instantiate(explosion, transform.position, transform.rotation);


Currently a new projectile spawns where the camera is, but if the camera moves the projectile does not. The first projectile does move however (it's a child of the camera.)



Justin -> Please use the 101010 tag at top to code-ify your code. Thanks!

I solved it by adding the same movement of camera script to the projectile. Works fine now.