Projectiles always going to the left and not forward

Hi,

I have a cube that is supposed to fire prefab cylinders which have a rigidbody. However, the cylinders are always coming out of the left side of the cube, instead of the front. I’ve tried changing the direction and using AddRelativeForce() but it will always come out of the left side.

Could someone explain to me why that is? Thanks.

void FixedUpdate () {
		speed = Input.GetAxisRaw("Horizontal") * acceleration;
		amountToMove = new Vector2(speed, 0);
		transform.Translate(amountToMove * Time.deltaTime);
		
		if(Input.GetButtonDown("Fire1")){
			Debug.Log("Fire1 pressed!");
			laser = Instantiate(laser, transform.position, transform.rotation) as GameObject;
			laser.rigidbody.AddForce(laser.transform.forward * Time.deltaTime);
		}
	}

void FixedUpdate () {
speed = Input.GetAxisRaw(“Horizontal”) * acceleration;
amountToMove = new Vector2(speed, 0);
transform.Translate(amountToMove * Time.deltaTime);

       if(Input.GetButtonDown("Fire1")){
         Debug.Log("Fire1 pressed!");
         laser = Instantiate(laser, transform.position, transform.rotation) as GameObject;
         laser.rigidbody.AddForce(Vector3.forward * Time.deltaTime);
       }
    }

you have to take Vector3.forward

That didn’t work either. Thank you though. I just solved the issue by taking a look at this example:

http://unity3d.com/learn/tutorials/modules/beginner/physics/assignments/brick-shooter