- Home /
Is there a way to set the current rotation of an object to 0,0,0?
what i mean is, i have an object that when it is 0,0,0 it is at a real screwed up rotation and i want it to be rotated so that it lies horizontal (its a long object). so the rotation values when i can make it horizontal are all screwed up.. x = 34.57777. y = 226.0514 z = 231.7793. this causes problems when i try to instantiate the object because it sets the rotation to 0,0,0 and it doesnt lie horizontal, so i was wondering if i could set the current rotation to equal 0,0,0 when the object lies horizontal? this is my instantiate line if it helps
Instantiate(thePrefab, leftwallpos, transform.rotation);
$$anonymous$$odeling program is best. I have an editor script that will solve this problem posted for another answer. You rotate your object to how you want it to appear select the object in the hierarchy, and the script will make a clone that has rotation (0,0,0) and scale (1,1,1):
http://answers.unity3d.com/questions/561786/how-to-export-obj-from-editor-with-rescaled-mesh.html
Answer by Invertex · Mar 02, 2014 at 09:56 AM
No, you need to make that change in your 3D modeling application of choice. Rotate the object in it and Freeze it's transforms. What this operation is called, varies from program to program though, that's what it's called in Maya.
Otherwise, look at what the rotation is that looks good for you, and use that rotation value when you instantiate.
edit: Of course, what "whydoidoit" describes is another option, as an empty game object won't create much overhead, though it makes things a tad messier.
Answer by whydoidoit · Mar 02, 2014 at 10:08 AM
Make an empty game object.
Add the model as a child of it
Rotate the model until it is correct
Create a prefab out of the parent
Use the prefab instead of the model.
Prefer @Invertex's solution if you have the ability to adjust the model.