How do I reference an object's rotation through an attached script?

I feel foolish, but I can’t find an answer to this anywhere. I have a first person camera from which I am launching a projectile. The following script is attached to it. When the projectile launches, it always points “North”; it always launches in the same direction and ignores my camera’s orientation.

var newObject : Transform;

function Update () {
	if (Input.GetButtonDown("Fire1")){
		Instantiate(newObject, transform.position, Quaternion.Euler(transform.rotation.x+90, transform.rotation.y, transform.rotation.z));
	}
}

And here’s the part that REALLY confuses me. If I use this instead:

Instantiate(newObject, transform.position, transform.rotation);
//This code doesn't allow me to slightly adjust the angle of firing

This code will launch the the projectile down the camera’s Z axis, like I expect. So why doesn’t it work when I use Quaternion.Euler instead?

use this line

Instantiate(newObject, transform.position, transform.rotation);

instead of

Instantiate(newObject, transform.position, Quaternion.Euler(transform.rotation.x+90, transform.rotation.y, transform.rotation.z));

transform.rotation is Quaternion. don’t use it’s components unless you understand how it works.

addon: if you want to rotate from initial rotation, use

C#:

Quaternion offsetFromForward = Quaternion.Euler(10f, 10f, 0f);
Instantiate(newObject, transform.position, transform.rotation * offsetFromForward);

JS:

var offsetFromForward : Quaternion = Quaternion.Euler(10f, 10f, 0f);
Instantiate(newObject, transform.position, transform.rotation * offsetFromForward);