Cannon wont fire in the same direction

I have a script for a cannon component of a ship, It is ment to be a game object parented to the ship.
For some reason it always fires in a different direction after the ship starts to turn, not the right direction along its forward, but a random one off in a different direction, what am I doing wrong?

var reloadtime : float;
var shot : GameObject;
var numshots : int;



enum guntype{
singlefire,
rapidfire,
chaingun,
}

var gunType : guntype;

private var loaded : boolean = true;
private var fireing : boolean = false;
private var t : Transform;

function Start(){
t = transform;
}



function FireCheck(){
switch(gunType){
case guntype.singlefire:
	if (loaded){Fire();}
	break;
case guntype.rapidfire:
	if (loaded){Fire();}
	break;
case guntype.chaingun:
	if (loaded && !fireing){fireing = true; loaded = false; Fire();}
	break;
}
}

function Fire(){
switch(gunType){
case guntype.singlefire:
	Instantiate(shot,t.position,t.rotation);
	loaded = false;
	yield WaitForSeconds(reloadtime);
	loaded = true;
	break;
case guntype.rapidfire:
	for (i=1;i < numshots; i++){
	Instantiate(shot,t.position,t.rotation);
	loaded = false;
	yield WaitForSeconds(reloadtime);
	loaded = true;
	}
	break;
case guntype.chaingun:
	while (fireing){
	var f1 : float = Mathf.Round(Input.GetAxis("Fire1"));
	if (f1 != 1) {fireing = false;}
	Instantiate(shot,t.position,t.rotation);
	yield WaitForSeconds(0.09);
	}
	yield WaitForSeconds(reloadtime);
	loaded = true;
	break;
}
}

thanks.

edit

bullet script, the bullet has no collider and the cannon is an empty game object other than the script.

var damage : float;
private var t : Transform;

function Start(){
t = transform;
print(t.forward);
Destroy(gameObject, 10);
}

function FixedUpdate(){
var ray : RaycastHit;
if (Physics.Raycast(t.position, t.forward, ray, 2))
{
ray.transform.gameObject.SendMessage("Damage",damage,SendMessageOptions.DontRequireReceiver);
Destroy(gameObject);
}
else{t.Translate(t.forward*2);}
}

edit : video of problem here - YouTube

I think, that the problem is, that you have Collider on both the turret/gun or whatever and the bullet and you are instantiating it at the turrets position, what leads to collision and the bullet flies away. If you want proper shooting, than make a spawn point, parent it to the turret/gun/etc… and set the rotation to face the opposite direction as the turret is. Than when when it instantiates it at and empty GameObject there is nothing to collide with, so it flies nicely. :). Second option is to set the bullet to trigger, but it won’t bounce then.

By default, Transform.Translate operates in the object’s local space (where “forward” is (0,0,1)), but transform.forward is in world space coordinates. Change the translate call to Translate(t.forward*2, Space.World).

That’s sort of a weird way to do the bullets, though. Why not just give them a rigid body and a velocity, and determine when they’ve hit something by collision messages?