I've created an obect, say a capsule, and in the scene windown i've rotated it 90 degrees, and now its a bullet. However when I instantiate this object, the rotation i've aplied the object/prefab doesn't follow through, and it still instantiates in its original orientation...
Which rotation are you using in the Instantiate instruction? If it's Quaternion.identity, the bullet keeps the same rotation as the prefab. If it is transform.rotation, then the object to which you've attached the script probably is rotated too - its rotation is combined to the original prefab's, producing the wrong direction.
answered Jul 21 '11 at 05:10 PM
maybe this is a little old, but I ran over the same issue and came up with two simple solutions:
1st- Place your object inside a empty game object at the desired rotation and create the prefab from this empty one. When you instantiate your prefab at identity rotation, the actual object inside the parent will keep the original saved rotation.
2nd- use this code to initialize object: Instantiate (myPrefab, new Vector3 (x ,y, z), myPrefab.transform.rotation); To be honest, I've not tried the second one, but I'm assuming it will spawn it at the prefab stored rotation.
answered Nov 29 '12 at 09:44 PM