I seem to be having some trouble with this script. It appears that the bullet is spawning at different Y Heights at random for some reason. Can anyone please figure out what is going wrong? This project is actually due soon so if I could get any help fast that would be really appreciated it
Bullet Spawn
var shootspeed = 10;
function Shoot (bullet : Rigidbody)
{
var shot = Instantiate(bullet,transform.position,transform.rotation);
shot.velocity = transform.TransformDirection (Vector3.forward * shootspeed);
}
Bullet Script
function Awake ()
{
Destroy(gameObject,3.0);
}
function OnCollisionEnter (collision : Collision)
{
collision.transform.BroadcastMessage("ApplyDamage",1);
Destroy(gameObject);
}
Thank You very much!