- Home /
Instantiating an object - unexpected rotation.
Hi! I've created a 3D model in SketchUp and now I'm trying to instatiate it in Unity through a C# script. I'm using this line to do so:
Instantiate(dynamicWall, new Vector3(0, 0, 0), Quaternion.identity);
When I try it in-game, the model is created almost flawlessly. The only porblem is that it's rotated 90° around the X axis. At first I thought there's a problem with the model or the prefab I'm instantiating, but when I drag-and-drop them from the Project panel into the scene, they are rotated just as I would expect them to be. The problem only emerges when I instantiate them dynamically. Why does this happen?
Answer by Fornoreason1000 · Dec 07, 2013 at 01:29 PM
its because your using Quaternion.identity, it resets the Euler rotation to (0,0,0).
uses this instead
Instantiate(dynamicWall, Vector3.zero, dynamicWall.transform.rotation);
the reason it rotates because some(most) 3d editors uses Z = up, while unity uses Y = up. so when unity imports models it imports them with a rotation of (-90,0,0) degrees to compensate.
when you instantiate using Quaternion.identity , you rotates back to (0,0,0). which is why they look rotated when you instantiated.
http://docs.unity3d.com/Documentation/ScriptReference/Quaternion-identity.html
Hope it helps
Your answer
![](https://koobas.hobune.stream/wayback/20220613123627im_/https://answers.unity.com/themes/thub/images/avi.jpg)