need some help with a stationary enemy!

hey guys! I’ve got some problems with a stationary enemy. I want the enemy to rotate along whit the player and fire when every 3rd second straight forward. but it only fire once and the bullet follows the player like a missal. here is the code Im using:

var Player : Transform;
var Bullet: Rigidbody ;
var BulletSpeed : int;
private var timer = 0.0;

function Update ()
{
transform.LookAt(Player);

timer += Time.deltaTime;
if (timer > 3)
{
timer = 0.0;

var tempBullet: Rigidbody;
tempBullet = Instantiate(Bullet, transform.position, transform.rotation);

}
}

please help! thanks

The problem is that the code doesn’t actually launch the new bullet when it is created. You need to add a force to make the rigidbody move:-

tempBullet.AddRelativeForce(Vector3.forward * launchForce);

Here, launchForce is just a variable defined somewhere in the script. You will need to tweak its value to see what looks right in the game.