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?