Hi,
For some reason, I cannot instantiate in front of the player after I rotate him. How can I keep the players y rotation the same as when I instantiate a projectile?
the script that I am doing this in is attached to the player:
GameObject instPrefab = (GameObject) Instantiate(Prefab, transform.position, Quaternion.Euler(Input.mousePosition.y * factor, Input.mousePosition.x, 0));
instPrefab.rigidbody.velocity = instPrefab.transform.TransformDirection(-Vector3.forward * 200); // is not fully in front of the player
I didn't try to figure out everything that's going on there, but it looks like you're making the common mistake of trying to treat the elements of a quaternion as (Euler) angles. This, for example:
Quaternion(transform.rotation.x, transform.rotation.y, transform.rotation.z, 1)
Almost certainly doesn't do what you think it does, and is very unlikely to do anything useful.
In short, use Transform.rotation and .localRotation when you want to work with the orientation directly in quaternion form, and Transform.eulerAngles and .localEulerAngles when you want to work with the orientation in Euler-angle form.