I have a bow which is a child to my main camera. My bow has a script attached that instantiates an arrow when the left mouse button is clicked. The problem is that I can’t get my clone to be rotated in the right direction. If I don’t mess with the rotation it is pointing straight up. If I set the rotation to be the bows for the x and z but the y to be 0 it points straight but if I rotate my character it doesn’t rotate with it. Just stays pointing to the left or right. Here is my code:
GameObject arrowClone = Instantiate(arrowPrefab) as GameObject;
arrowClone.transform.position = gameObject.transform.position;
arrowClone.transform.rotation = Quaternion.Euler(gameObject.transform.rotation.x, 0, gameObject.transform.rotation.z);
Can anyone shed some light on this situation?