Unity Unique Situation Import Rotation Bug?

In Blender through current and previous versions.
In Unity Current and previous versions:

if you have only a single mesh object in the file and export into unity (dragging .blend files into folder for instance) it will NOT Apply the proper rotation conversion to the object. Leaving you with the 270 degree Z vs Y up axis issue.

I have searched for references to this bug and have not found any. Maybe others do not deal with simple meshes.

It’s simple to replicate. Create a simple object in blender (Z-up), A cone for instance. Remove EVERYTHING else, camera, light. Save and open in Unity. It will not be Y-up in unity. Go back into blender and Add a plane, or a bone, or any other mesh, etc. to the cone, and re-import into unity, all will be fine with the world.

This has led us to always Adding a bone or a hidden plane in simple objects to correct… which is less than optimal…
Is there any more standard/proper way to address this issue? Is this a known bug in Unity Importing, or Blender Export??

Thanks much!

Basically, the axis and rotations that Blender uses is not the same as what Unity uses.

I think the answer has been to use a modeling program that matches Unity’s axises, or make a converter that will convert Blender models to the same axis and rotations that Unity uses, or get the Blender team to add the feature to export to the same axis Unity uses.

This was the most useful forum thread I could find on a quick search.
http://forum.unity3d.com/threads/181870-Blender-gt-Unity-Rotation-Fix

You can vote in this link for this suggestion: fbx importer correct orientation

[LOOK zombiegorilla method]

(Vr.01)
I start making the object with a cube and not with the cylinder or sphere.( Because I do not trust the shadow uv i get when i import it to Unity)
If i need a cylinder i trim the cube to get the cylinder.

Make changes in Edit Mode (is Local) and not in ObjectMode.
I lock location rotation and Scale editing in Object mode Transform (n shortcut)

I select the final object to export and export as FBX
In Export FBX options I select “Selected Object”
Forward: -Z Forward
Up: Y Up
Precision 6

Then in Unity, i select the model and in the inspector apply scale 1 (from 0.01)
If there is no animation, in the inspector Rig, “Animation Type” choose “none” and then apply.
When i drag and drop the model into the scene I rotate it 90 in X.

When you import using the .blend file it will compensate for the difference by setting the x axis to -90. What you are seeing is the difference in how it handles single and multiple objects.

For a single object, the -90 will be applied to the prefab that is generated. If you have multiple, the prefab will be 0, but all the objects inside it will be at -90.

The idea, I believe that is that whatever file you use, the Unity will compensate so that dragging it the stage it looks correct.

Its not a bug, it is just that they just use different axises. Typically what I do is when I am finished with a model I will rotate in blender -90 on the x, and apply rotation. I usually put several models in a particular file, I and separate them in their own prefabs for use in the game, rather than use the auto generated prefab from the conversion.

Thank ZombieGorilla you are a Master!
Now i can move my object not passing through fbx . This was working good for me.
The problem was “rotate in blender -90 on the x” all objects.

In Blender to rotate all, you need to select all the objects [A] or . Then go to Right ortho view [3 Numpad]
and start the rotation [R] to the correct right clock rotation. At that point add in console 90 directly. Or add -90 two times. Do not use the input rotation panel.
I was using the input rotation panel and I was not able to rotate all object.
Then when I import the blender file into Unity, I take out the extra 90 putting 0° in x of the multiple objects in the inspector.
The gizmo rotation is not in the correct Local position in space but if you rotate form the inspector, the rotation is well applied.
This zombiegorilla method gives same “Local” and “World” xyz.
And it work for me importing multiple mesh from Blender 2.70 to Unity 4.3.4

ZombieGorilla, Thanks for the reply, you do understand the issue, and you are correct that When you drag a “Singular” vs compound object into a scene by hand, it does “Right” it. However, Both in the Asset preview Panel, it’s Sideways, and also when using Resources.Load, The rotation is not handled equivalently.

This is definitely not optimal, Since A Blender artist making assets with 1 vs 2 meshes will behave differently.

I understand that making prefabs or tweaking rotations by hand can alleviate, But it is really handy and nearly works perfect to just use all the auto-rotation and auto-import Unity/Blender provides. It’s just this issue that throws a wrench in the mix.

To repeat: A single mesh brought into scene via Resources.Load Will NOT get auto rotated.
Go back into blender, Add a hidden plane or something, Now it Will have proper Y up applied.

-Joe

I totally agree. 100% I believe they should be handled exactly the same way, primarily for the reasons you stated (automation/not being touched by hand).

On the upside, it is consistent and known. (not consistent on 1 vs. n meshes, but the handling). But, unless I have completely missed it, this aspect isn’t anywhere in the documentation. At the very least it should be.

I do think it should be changed to either straight up rotate the axis to match (not just rotate the model(s)) or just completely ignore it, and communicate it to the user. Or just provide it as an option in the import settings. The only challenge would be that they don’t change it in a way that would break existing projects.

Thanks again Zombie,

Now I wonder if someone more experienced than I would have an optimal solution to a Resource.Load
Usage case on Objects with 1 or more parts. To handle the rotation issue discussed above.

My hacks in blender of:

#1) adding an empty armature (Terrible, since it forces SkinnedMeshRenderer for no reason)
or
#2) adding a Hidden Plane – Sloppy, tiny performance hit since separate mesh, and prone to sight bugs if not handled carefully…

Any better ideas? I wonder if I could search for # of components? Or, no it would be number of children? And then Rotate Manually After Every Resources.Load if Number of children=0? But any port-processing like this doesn’t know if it’s in fact a blender model, And not a prefab or something already correct… . . Best solution would be A way to call an Unity editor script only upon .Blend importing, Where it can know the num of children and apply the rotate there? (Like the original system should have…)

Or how does Unity know to rotate only these No-Child objects upon placing in scene… If I could Tee off a similar Cue during Resources.Load that could work also… Or just any other more “Empty” placeholder Blender object I could add?

Thanks much!

Wanting to come up with a better solution before the next 100’s of objects created/imported.

EDIT ADDENDUM: After searching Blender, I found I could do ADD → EMPTY → CUBE And then
this cube becomes an empty Transform in UNITY, but it’s enough to force Unity to consistently rotate, and it should be lighter than Armature ora hidden Plane, So I will switch to having artists always add an empty cube to objects. On the plus side, It can also be used as a single textual “Tag” for passing info to Unity from Blender.

A editor code fix would still be preferable, but at least this cuts down on the performance hit of previous 2 hacks.