Bullet SCript Issue

I created a script for a bullet instantiation, but when I play it, the bullets just float away. Here’s the code,

// Instantiate a rigidbody then set the velocity

var projectile : Rigidbody;

function Update () {
// Ctrl was pressed, launch a projectile
if (Input.GetButtonDown("Fire1")) {
// Instantiate the projectile at the position and rotation of this transform
var clone : Rigidbody;
clone = Instantiate(projectile, transform.position, transform.rotation);

// Give the cloned object an initial velocity along the current
// object's Z axis
clone.velocity = transform.TransformDirection (Vector3.forward * 10);
}
}

Anyone know why it does this?
BTW, there are no errors in the code, and it is just the default bullet instantiation code in the scripting reference.

Probably cos the bullets are colliding with the model. Try doing the script on an empty game object without any colliders or instanticating them away from the model.

I am sure spinaljack is right, so use Unity - Scripting API: Physics.IgnoreCollision right after Instantiate

Now it’s just spitting out hundreds of errors and shooting LOTS of projectiles without me even doing anything. Here’s a video I just recorded on it.

post the whole script. Or download fps demo and dig into their script, also java btw

Wait…I might have something. I re-read Spinaljack’s post, and I think I understand it. Let me go check it out.

It works now! You guys are the best! Thanks!