Transform.position bullet won't align

I am creating an fps, and I am using:

var projectile = Instantiate(shot, transform.position, Quaternion.identity); projectile.rigidbody.AddForce(transform.right
* 2000); print(transform.position);

the script is attached to the gun, the problem is that I want the bullet to originate from the barrel so I can change its flight path, instead it starts from 0.0 of the gun, how do I change this?

Cheers, Joe.

Make an empty game object called something like “BulletSpawnPoint” and then manually place that at the end of the barrel. Make sure that object is a child of the gun.

Spawn the bullet from that object instead of from the gun object directly.