Bullet shots isn't in the center

I have a a bullet prefab, rigid body added, with 0.1 mass, use gravity checked. and i have a cross hair at the center of the screen. My prob is that, it doesn't shoot in the middle of the crosshair, it's slightly shooting around a few cm to the left of the crosshair.

I also had locked the cursor, but it didn't fixed the problem. How can i shoot in the middle?Do i need to adjust the mass?the force or something?

here is my code for shooting:

var projectile: Rigidbody;

function Update () {
        var instantiatedProjectile:Rigidbody=Instantiate(projectile,transform.position,transform.rotation);



If you are shooting your projectile out of a gun, then more than likely you have rotated the gun slightly off center with the 1st person controller. Then, since you are launching the bullet in the same direction, it will be slightly askew from the forward vector of the camera so it will fly in a slightly off direction.

The easiest way to fix that would be to reset your gun's y euler rotation or to give the projectile its direction from something else.

    var instantiatedProjectile : Rigidbody = Instantiate(projectile,transform.position,transform.root.rotation);


That line of code is your problem. Try multiplying some Speed * transform.forward; Also, if you find that your rotation isn't what you're wanting then use:


Instead of


hey im have a similar problem, well i have my gun and the spwan point for the bullit right in front of the nozzle (tip) and it shoots fine except if you watch the bullit travel it flys and then is almost pulled to the floor almost as if the bullet is magnetically attracted to the floor, so if i aim up woods the bullet flys straight for the ground. ANy thoughts ???