Fps bullet direction help

i have make my first FPS game, and my bullet doesnt follow the direction of the FPS camera. it does follow when i look right or left, but not up or down. It just keep shooting the same height. help!

This is the code that i have done for the shooting script.

var prefabBullet:Transform;

var shootForce:float;

var rotateSpeed = 3.0;

function Update()




var instanceBullet = Instantiate(prefabBullet, GameObject. Find(‘spawnpoint’).transform.position, Quaternion.identity);

instanceBullet.rigidbody.AddForce(transform.forward * shootForce);



Use the camera’s forward vector instead of the player’s forward:

  AddForce(Camera.main.transform.forward * shootForce);

try to put the script on the camera or write:
GameObject. Find(‘spawnpoint’).transform.forward
instand of:

(just if the camera is the parent of the spawnpoint)

no, the spawnpoint is a cube that is in front of the camera. this was added because of making the rotation to left and right working properly, it did work (i think)but very bad. I tryed to make everything again without the cube as ‘‘spawnpoint’’ and instead ‘‘First Person Controller’’ (the name of my FPS), but it didint work either. It just shoot a straight line forward, that i cant navigate up and down, if i dont walk back and forward instead.hope you understand what i mean

My first person controller is the one you get when downloading the game

But thanks for the answer! Have any other ideas? What can be wrong?