- Home /
reorienting a mesh from 3d max in unity?
I've imported a mesh (3d studio max file) into Unity by drag and drop into the project window.
when I instantiate it in my c# code, it is oriented in the wrong way for my use (unity trasform.forward is not forward for the mesh).
So I put the mesh into a gameobject in the project window and reoriented it so its facing the correct way. But when I instantiate it in my c# code it still is oriented the original way (and not the way I oriented it in the project/inspector window). I don't want to reorient it in my code after instantiate it,
I'd like to reorient it in the inspector so when I instantiate it is facing the correct way (the orientation I want).
How can I do this to the mesh in the project window?
Answer by Cherno · Mar 15, 2015 at 08:03 PM
I don't think it's possible. Normally, you would rotate the pivot inside Max (in Max, to conform with Unity's axis system, the green arrow has to point upwards and the blue one to the front).
If I put the mesh into a gameobject in the project window and then I orient the gameobject to face the way I want. Is it possible to preserve the gameobject's (in the project window) orientation when I instantiate it?
That doesn't make sense because if you rotate a game object, you also rotate the axis.
$$anonymous$$aybe what I am asking is not clear....
If I put the mesh into a gameobject in the project window and then I orient the gameobject to face the way I want. Is it possible to preserve the gameobject's (in the project window) orientation when I instantiate it?
Currently, if I do the rotation in the project/inspector when I instantiate the gameobject orientation is 0,0,0 (and not 270,180,0 as I set it in the inspector).
Well, the Instantiate function accepts a Quaternion parameter to set the rotation of a newly instantiated object. If you pass it the transform.rotation of the prefab object, it should use those values. However, I don't see how this is related to the problem you stated in your original question about "unity trasform.forward is not forward for the mesh", as this is related to the pivot orientation relative to the mesh itself, and can not be changed in Unity.
How can I get (read) the transform.rotation of the prefab object?
I will be putting the mesh (or GO->mesh) inside another GO whose .forward will be used to move the object. The idea is that the mesh (or GO->mesh) can spin freely inside the parent GO so the parent GO can be moving (.forward) while the inserted mesh can point (its .forward) in another direction.
So at load I can keep track of the displacement between the mesh.forward and GO.forward and adjust. But I want to load that displacement by reorienting the mesh in the project panel. I have many objects to load and they all have their .forward displaced from Unity's .forward. SO easier to do it in the project panel than to have to write code to keep track of what GO did I just load and what its displacement is. Hope this was somewhat clear :-)...
Your answer
Follow this Question
Related Questions
How to rotate and re size an imported mesh ? 0 Answers
I imported a character from blender into unity but the mesh of that character is horizontal? 2 Answers
how to make an horizontal mesh? c# 0 Answers
unity vertex order 1 Answer
Create a mesh of earth 0 Answers