# Weird translation after instantiating on transform.rotation

Hi, I’m making a basic shooting script, but whenever I rotate my player around, my bullets seem to be rotated in all the wrong directions. I’m basically instantiating them with my players transform position and rotation, and then have them move with transform.forward using a script on the bullet. I don’t get why the rotations are acting like this tho.

Here’s my 2 scripts, simple yet not working properly:

``````#pragma strict
var bullet: GameObject;
var offset: Vector3;
var fireRate: float = 1;
var curRot: Quaternion;
var curPos: Vector3;

function Awake()
{
InvokeRepeating("Shoot",0, fireRate/10);
}

function Update()
{
offset = transform.forward * 10;
curRot = transform.rotation;
curPos = transform.position + offset;
}

function Shoot()
{
if(Input.GetMouseButton(0))
{
Instantiate(bullet,curPos,curRot);
}
}
``````

and for the bullet:

``````#pragma strict
var bulletForce: float = 2;
var player: GameObject;

function Awake()
{
player = GameObject.FindWithTag("Player");
Destroy(gameObject, 3);
}

function Update()
{
transform.Translate(transform.forward * bulletForce);
}
``````

Anyway, to me this looks like it should work, yet it seems somewhat like I’m multiplying the rotation somehow, as the further I rotate from 0, the farther off the rotations on the bullets seem to be.

Any Idea’s?

PS: I do have a rigidbody with a drag of 10 and an angular drag of 1 attached to my player, could this have something to do with it?

Look the doc for Translate, the default space is already Self. By using transform.forward instead of Vector3.forward, you’re applying the rotation twice.

Translate is already working in local space, so using transform.forward is doubling the effect. Use Vector3(0,0,1) instead or set the second parameter of Translate to Space.world.