I am trying to have the player throw a fireball prefab every time the left-mouse button is clicked. The fireball spawns and is thrown away from the player, however, it always goes the same direction. The rotation I give the fireball is that of the camera’s X and the player’s Y. I can’t seem to figure out why it is not using the correct rotation.
if(Input.GetButtonDown("Fire1")){
GameObject temp = (GameObject)GameObject.Instantiate(fireBall,
new Vector3(player.transform.position.x,
player.transform.position.y,
player.transform.position.z),
Quaternion.Euler(camera.transform.eulerAngles.x,
player.transform.eulerAngles.y,
0));
Debug.Log(camera.transform.rotation.eulerAngles.x);
Debug.Log(player.transform.rotation.eulerAngles.y);
temp.rigidbody.AddForce(force, force, force);