Making a gun shoot

Hi, I'm new to Unity and I'm trying to make a simple FPS. My problem is that when I shoot, the bullet doesn't go where I'm aiming, it just shoots right in front of me even if I'm aiming all the way up or down. Here's a screenshot. http://img21.imageshack.us/img21/1820/screenshotxwq.png

Here's the script I used for shooting. (And I don't really know much about scripting, I just got this from tutorials and stuff)

var BulletPrefab:Transform;
var force : float = 2000;

function Update()
{
if(Input.GetButtonDown("Fire1"))
{
var bullet = Instantiate(BulletPrefab, 

GameObject.Find("spawnPoint").transform.position, 

GameObject.Find("Gun").transform.rotation);

bullet.rigidbody.AddForce(transform.forward * force);

}
}

How do I fix this?

Thanks.

It looks like the transform "forward" that you're referring to in that last line is the transform of whatever GameObject this script is attached to, rather than the transform of the bullet or the gun, which is probably what you need:

bullet.rigidbody.AddForce(bullet.transform.forward * force);

Alternatively, you could add a Constant Force Component to the bullet prefab and it could handle its own motion.

if the spawnpoint is at th end of the gun, and if it follows the camera this shouldn't happen.

var BulletPrefab :Transform;
var force : float = 2000;

function Update()
{
if(Input.GetButtonDown(“Fire1”))
{
var bullet = Instantiate(BulletPrefab,

GameObject.Find(“spawnPoint”).transform.position,

Quaternion.identity);

bullet.rigidbody.AddForce(transform.forward * force);

}
}

try this script.make sure that your bullet prefab has a rigidbody attached to it.