Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Z and Y Axis

Discussion in 'External Tools' started by Horror, Jul 18, 2011.

  1. Horror

    Horror

    Joined:
    Jul 18, 2011
    Posts:
    207
    Hi everyone, first post here!

    I know that Blender's Z axis is different to Unity's but I can't find a way to correct the FBX export. I've read something about a checkbox called "Rotate X90" which is meant to correct the problem, but I can't find the button on Blender 2.58. I've tried mucking about with the Forward and Up directions on the export but this is only changing the orientation of the model, and not it's relation to the axis.

    My model imports fine, aside from the incorrect axis. Not sure if this is even a problem, but I'm thinking it might come back to bite me later once animation comes into it.

    Any suggestions on how I might fix this, or whether it's even an issue to be concerned about?

    Cheers!
     
  2. Robert_Duffill

    Robert_Duffill

    Joined:
    Apr 12, 2010
    Posts:
    162
    From the tests I've run using Blender 2.58 and the latest free version of Unity just ignore the difference and let the most recent Blender-Unity.py off this forum convert directly from the .blend file. I've had multiple animations work perfectly on a rigged character in Unity with all the axes corrected automatically.
     
  3. Horror

    Horror

    Joined:
    Jul 18, 2011
    Posts:
    207
    Sorry, what thread was that under?
     
  4. Robert_Duffill

    Robert_Duffill

    Joined:
    Apr 12, 2010
    Posts:
    162
    This is the file I use at the moment with Blender 2.58. Download it and replace the current version within your Unity installation directory. If you use windows its:

    ...(Local Drives)>Unity>Editor>Data>Tools

    Paste that file into that folder and then just add your .blend files into your projects Assets folder and they will automatically import as a .FBX

    Remember to back up the old .py file. Hope that helps.
     
  5. Tiles

    Tiles

    Joined:
    Feb 5, 2010
    Posts:
    2,473
    Just in case, and when you always use the newest graphicall version, the fbx settings in blender can be found in the export dialogue.

    I`ve already moaned about the object orientation at exporting to fbx too, but without luck. The blender devs are happy with the current settings as the default export settings. Maybe when more people complain ...
     
  6. Horror

    Horror

    Joined:
    Jul 18, 2011
    Posts:
    207
    Thanks for posting the link :)

    Unity can actually read a .blend file without having a hissy fit now. Something is not quite right - my models are absolutely huge when I drop them into Unity! (they are the right size when I export the fbx manually from Blender)

    It doesn't solve the problem with the axis though; my models still have X rotated 90 degrees to what it should be. Atleast It doesn't sound like this has caused you any trouble.

    Too bad we can't have an option in Blender to set which direction is Z and which is Y! Yes, maybe we all need to complain more :)

    Cheers
     
  7. Tiles

    Tiles

    Joined:
    Feb 5, 2010
    Posts:
    2,473
    Horror, have a closer look at my posted screenshot. I have set the red arrow for good reason. You can define the direction of the exported mesh. Just change the Forward directon -Z to Z. Or was it Y? Humm, trapped again ...

    Point is, you can change the forward direction, which defines the directon in which the FBX gets imported. It just doesn`t fit to Unity anymore by default :)
     
  8. Horror

    Horror

    Joined:
    Jul 18, 2011
    Posts:
    207
    I tried mucking around with that, but it only changes the angle that the model is facing when imported; the orientation of the axis rotates with the model. This has only caused my character to face backwards.

    Right now, my Unity object containing the individual meshes has the correct orientation (Z to the front, Y to the top, X to the side), but if I click the individual mesh elements within the object group the orientation is different (Z to the top, Y to the back, X to the side). The only other way I could think to correct this is to rotate the model 90 degrees onto its back in blender, export, and then rotate it back 90 degrees in Unity. And I'm not doing that :p
     
    Last edited: Jul 20, 2011
  9. Tiles

    Tiles

    Joined:
    Feb 5, 2010
    Posts:
    2,473
    Hm, i was able to get it to work that way. Odd.
     
  10. Redbeer

    Redbeer

    Joined:
    Nov 1, 2009
    Posts:
    402
    Blender is Z up, Unity is Y up. This is the nature of the beast for ANY set of 3D programs, some choose Y, some Z, some offer both as "options".
    I believe it works like this, but I'm open to correction:
    Max is Z up.
    Maya is Y up but you can switch it.
    Blender is Z up.
    Softimage is Y up.
    C4D is Y up.
    Lightwave is Y up.
    Most CAD software is Z up.

    Then there's left handed vs. right handed...and some programs may choose to rotate in their FBX export as default...

    Which one is right?

    That said, using the FBX link that Robert-Glen provided should work just fine. The axes of the object will of course be reversed with the axes of the "world", since Z will be aligned to Y and the positive Y on the object will point opposite to positive Z in Unity, but this is NOT a problem as long as you maintain the same coordinates in Blender itself for all your objects and animations. Obviously if you model something sideways in Blender it will now be sideways in Unity and therefore not match up with rotation of your other objects, or Unity world. Essentially it's just a difference between "local" and world coordinates. This happens in all software going to Unity, and within the software itself. You can see this in Blender where the object has it's own coordinate system that can be rotated in relation to the world coordinates. This is simply how you keep track of specific rotations of objects in 3D space in relation to a world standard, no big deal.
     
  11. Horror

    Horror

    Joined:
    Jul 18, 2011
    Posts:
    207
    Thanks for the explanation, I'll be sure to keep my models consistent. These kind of things make me paranoid, so I thought it'd be best to just throw the question out there ;)
     
    Last edited: Jul 20, 2011
  12. Shaba1

    Shaba1

    Joined:
    Jan 21, 2010
    Posts:
    48
    Ok bottom line. How do you fix thing IF you want to DRAG and DROP blend files into your project folder. Files that you have already created. I hope its not a matter of going back and redoing all the animations on those files :(

    Right now if I drag and drop a human character blend file It imports fine but is facing away from the monitor int he scene view. Where it was facing toward me/the monitor in blender.
     
  13. Tysoe

    Tysoe

    Joined:
    Jul 6, 2009
    Posts:
    577
    It's been an ongoing problem with unitys art pipeline for years. Check out the wishlist page, over 420 votes to have this fixed. Ranked 19th after stuff like Linux version, Shader Editor, better 2D etc. So should be quite a high priority to come up with some solution, even if it's just a toggle to set a default import setting to transpose the coordinates from right handed to left handed for those apps that have non compatible orientation.

    You can vote to have this fixed on the Unity Feedback Page at:

    http://feedback.unity3d.com/forums/...orrect-orientation-and-without-game?ref=title

    A solution was assured by the Unity devs for soon after GDC 2010 but never materialized :(
     
    Last edited: Oct 29, 2011
  14. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    949
    After a LOT of playing around I have found a way to fix object orientation without messing around with export settings in Blender. It seems that the problem lies within the local object axis.

    Steps to solve problem:

    1. Select object in Blender and rotate on X-axis by -90 degrees (don't panic! we'll fix it for Blender and Unity)
    2. From "Object" menu select "Apply > Rotation"
    3. According to Blender the object is no longer rotated. Rotate object by 90 degrees and presto!

    Orientations are now correct in both Blender and Unity with rotation (0,0,0) in Unity and (90,0,0) in Blender!
     
    spannner likes this.
  15. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,670
    numberkruncher: This works because you have an unapplied rotation in Blender, so the rotation (as it is unapplied) does not get passed back to Unity on import. I'm unclear if this will cause any knock-on issues because this is a bit of a hack. I'll experiment with this to see if there are any drawbacks, but one should be aware that there is an unapplied change in Blender... just... hanging around... looking for trouble.
     
  16. w00dn

    w00dn

    Joined:
    Apr 28, 2010
    Posts:
    275
  17. FIREDANCEXS

    FIREDANCEXS

    Joined:
    Jan 30, 2012
    Posts:
    17
    Hi all, I am having a similar problem. Everytime I import this car model into Unity the x rotation is -90 but I need it to be 0. I have tried the export fbx settings in 3dsmax but I cant seem to get it to work.

    Can anyone please help? In Unity I would like all the rotations to be 0,0,0 when imported.
    Please!!!

    http://www.mediafire.com/?twucouanhujfsxb
     
  18. bfreese

    bfreese

    Joined:
    Nov 11, 2009
    Posts:
    4
    The REAL problem with the axis rotation is that when you try to script anything using Unity coords and a Blender file (native blend format or FBX with axis adjustment) you end up with huge problem. You cant use the standard x,z ground plane because it will not transform your object correctly. So you have to have TWO sets of code. One set of code for Blender and FBX and another set for anything made in Unity or another software that uses the same axis system as Unity.

    If anyone has a good idea about how to fix this please share. I very much like Blender as my production tool but have not found a good way around this problem. Maybe always parent Blender/FBX to an empty in a prefab? But then it gets complex when you want to do anything animation wise with the model itself in script? Don't know if that will cause problems yet.
     
  19. MariuszKowalczyk

    MariuszKowalczyk

    Joined:
    Nov 29, 2011
    Posts:
    245
    Last edited: Apr 16, 2012
  20. ScriptGeek

    ScriptGeek

    Joined:
    Mar 4, 2011
    Posts:
    45
    I'm working with a model that consists of several objects in Blender and when I imported them into Unity and created a script, I began ripping my hair out trying to figure out how to get the two silly coordinate systems to cooperate when the forward vector of a blender object is really the right vector of that object in Unity. I needed to develop a solution that rotated the objects in relation to each other. I eventually abandoned the idea of using an armature to maintain the relationships between objects and just parented each object to each other without using any bones whatsoever and I still ran into difficulties with the coordinate systems. At some point I will want to incorporate animations into the model and I guess I'll get to it whenever I decide I need to take more abuse. My solution was to use Quaternions to perform the rotations and a hack that rotates an object so that its pseudo forward vector faced the real forward position it was supposed to have. This is extremely obnoxious, is there really no decent solution to work with these coordinate system differences?

    I tried Robert-Glen's solution for the Unity importer, but it doesn't seem to work with the versions I'm running: Blender 2.62 and Unity 3.4.2f3.
     
  21. Robert_Duffill

    Robert_Duffill

    Joined:
    Apr 12, 2010
    Posts:
    162
    Sorry about the outdated .py file. I deleted it now to save anyone else some time. I currently use .fbx exports in my blender > unity pipeline so I can't even help out with the most recent version of it but I'm sure with some quick searching it would be around.

    I use the method numberkruncher mentioned above..

    I haven't had any issues from this yet with either basic objects or skinned meshes so I'll continue to use it until I run into a problem.
     
  22. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,670
    With Blender, there are a few solutions to this and a caution.

    First the caution:
    Watch out for unapplied rotations. If you back-read a bit you will see how one member suggests using unapplied rotations to solve the problem. This may be a valid solution, but I have never tested it, and I'd be worried about basing my axes on a work around using unapplied rotations.

    What are unapplied rotations? (And this also is true for scale...) If you rotate or scale on object in OBJECT mode rather that EDIT mode, Blender keeps track of the rotation and scale in the .blend file, not in the mesh itself. When the model is imported into Unity, Unity only takes the mesh into consideration. If you have multiple meshes, and some have unapplied rotations or scale, these meshes with import in an unwanted way. In general, make sure that all of your rotations and scales are applied:


    Assuming all of your rotations and scales are applied, there are several solutions to making sure your model appears properly in Unity. You decision as to which you choose, depends upon your pipe-line.

    The solutions:
    The most common method is to drive a parent GameObject and have the animated model as a child. Look at the Penelope demo for an example of this, where the game logic is driving a capsule collider / character controller, and the animated model is a child and follows along. The game logic then calls the appropriate animation on the child model which follows seamlessly along. This is true as well to hard bodied models, like starships or aeroplanes. If you look carefully, Unity should do this automatically.

    I have two meshes here, the sphere and the cone which in Blender are on the default x,y plane with z up:


    I save the .blend file into the assets folder of a Unity project, and it is automatically imported. As you can see, the model comes in on the x,z plane with y up:


    Looking at the meshes they are wrapped automatically in a parent GameObject with adjusted transforms:


    Each mesh has its transform adjusted locally:


    When driving the model, drive the parent GameObject and the child meshes will follow.

    If you have one single combined mesh, then yes, the model will not have a parent GameObject, but will come in with it's transform adjusted, usually by simply having the Transform.x set to -90.0. If this is a problem, then you can simply make your own parent GameObject.

    Alternatively, you can, as the last step before you save and import, select all of your meshes in blender and rotate them 90* in Blender and apply the rotation and scale, thus making the orientation match Unity's orientation. I have only done this on hard bodied models like level geometry. I'm unclear how this will affect applied animations to a complex animated model If you do this, you will have to remember to rotate your geometry back and apply that rotation before continuing any more work.

    Lastly, if you back read (as I mentioned) there is this "trick" of deliberately changing the rotation applying, and back rotating an NOT applying. And you've seen my worry about this one. Could be fine... makes me nervous.
     
  23. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,670
    I suppose that this could work if you make double plus sure you do all of your scaling and rotation after you set things up like this in EDIT mode, so you don't have any other un-applied rotations to any of your objects other than the base rotation... tho' I have not tested this to see what would happen if you did.
     
  24. Robert_Duffill

    Robert_Duffill

    Joined:
    Apr 12, 2010
    Posts:
    162
    @Little Angel I'm near OCD when it comes to file structure neatness and besides that single rotation being left unapplied everything else is in order. If something does come up as a problem and I track it back to this needing to be addressed for a fix then I'll be sure to update this thread.
     
  25. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,670
    Robert-Glen: This is good news. It is a good work-around then. I always feel uncomfortable recommending anything I have not tested, and I am naturally conservative when it comes to computers... so thanks for the practical information.

    I'll give it a shot the next time I'm in Blender and give it a spin!
     
  26. ScriptGeek

    ScriptGeek

    Joined:
    Mar 4, 2011
    Posts:
    45
    Thank you for your comments, guys; although, I'm still not sure I understand the solution:

    I'm confused by list item 3, where it says "Rotate object by 90 degrees and presto!". Rotate object by 90 degrees in Blender or Unity? Either way, it still doesn't seem to fix the model's forward vector as it still seems to be 90 degrees off with the up vector facing down. Maybe rotating the object in EDIT mode would tweak the mesh of the objects to appear in the correct orientation? This still feels very hackish to me.
     
  27. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,670
    Interesting.

    Here is my experiment.

    I created a cone with 6 edges and flattened it making sure it was aligned on the x,y plane:


    Then I rotated it on the x = -90*, so it's on the x,z plane:


    Then I saved the rotation and scale:


    Then I rotated it on the x = 90* so it's back to the x,y plane where it started from:


    Then I imported it into Unity - and it's on the x,z plane:


    Now, what's fascinating, is that I added, in OBJECT mode, an unmodified cylinder:


    Then I saved this change and swapped back to Unity, expecting the orientation of the cylinder to be 90* to the wedge... and it wasn't:


    Try this trick with primitive shapes and see if you can work out your pipeline before moving on to complex ones. I'm still wary of this, but it's proving worth the investigation...
     
  28. ScriptGeek

    ScriptGeek

    Joined:
    Mar 4, 2011
    Posts:
    45
    Thanks, Little Angel, that explains it nicely. I've managed to get my original model transformed correctly to display the three parented nested objects properly with the appropriately desired directional vectors, forward, up, and right, within Unity. At some point, I'll incorporate some animations into the model, but I'm satisfied with static meshes for now.
     
  29. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,670
    That's great!

    Frankly, I was expecting the cylinder to come into Unity un-rotated, as the trick had not been applied to it as a new mesh created in OBJECT mode.... so... move slowly and proceed with caution. Perhaps as a new mesh, it takes the rotation of the last saved mesh??

    Glad you've got things working.
     
  30. Robert_Duffill

    Robert_Duffill

    Joined:
    Apr 12, 2010
    Posts:
    162
    So I duplicated the same test you performed Little Angel. Only difference I think is you auto export directly from the .blend yet I export all my objects as raw .fbx format but I think it won't matter overall.

    The part where you were expecting the unmodified cylinder to appear in Unity rotated I think is a little off because the orientation of objects between Unity and Blender have always matched with the exception of their Transform component having Rotation X -90. Regarding the test performed once you reimported after saving with the cylinder added did you end up with a hierarchy like...

    Top Level Parent (I think it inherits the name of the .blend file being automatically imported from)
    > Cone
    > Cylinder

    To get this result my end: Within Blender I added a new cylinder in Object mode to the scene, selected both the cylinder and cone then exported as a .fbx. Checking through the hierarchy in Unity looking at Transform components of each and checking their X Rotation value gave me the following results...

    Top Level Parent (Named from the .fbx export of multiple Objects) - Transform X Rotation Value: 0
    > Cone - Transform X Rotation Value: 0
    > Cylinder - Transform X Rotation Value: -90

    I'm sure you would of got the same results importing directly from the .blend file. The top level parent shows no rotation as its more like an Empty, just a container for the Objects within, the cone shows 0 rotation because you performed the "hack" fix and the cylinder -90 without the fix.

    My approach is any single Object I bring from Blender > Unity gets the quick fix using the unapplied X rotation method as I personally prefer all my models to have a starting Transform value of 0 and I think if you decide to use it on only some objects and then not others your more likely to run into problems down the road. I'm going to do some more quick tests now using Armatures and having Skinned Meshes within Unity and see if I can find any troublesome areas.
     
  31. Robert_Duffill

    Robert_Duffill

    Joined:
    Apr 12, 2010
    Posts:
    162
    I done some quick tests with Armatures and the pipeline from Blender > Unity and attempted to see if I could get any errors by mix and matching Mesh objects using the quick hack fix and others not using it and also the armature using it then not using it et cetera. Going off these basic animation tests it seems that so long as your animation plays correctly in Blender then it works correctly in Unity regardless of the pairs rotation mix mash.

    I think it could be problematic later on if you plan to use procedural animation for anything a bit more complex then maybe having a mismatch between mesh and armatures using or not using the hack fix but that's beyond my testing and code skills. If I run into problems then I'll post back here.
     
  32. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,670
    Interesting.

    I would have thought that the "unapplied rotation" would have been on a per mesh basis.

    This is why I would have assumed that the cylinder would have come in as un-fixed and the cone as fixed.

    Clearly there is something more complicated going on here.

    As I'm doing tests in general, I'll start adopting this method and use my other tests to stress this method and see if it breaks.

    [edit] which is does...

    The un-rotated transform is evident in they cylinder as it's transform.x is at -90* which means that that this mesh is being "fixed" automatically by the same internal fix that Unity applies to Blender meshes. And it's the parent GameObject that would need to be manipulated.

    So, in the end I was correct. For each mesh to be correct, you'd need to apply this "trick" to each mesh, or you'd need to make sure that each new mesh was added in EDIT mode to the current mesh.
     
  33. ScriptGeek

    ScriptGeek

    Joined:
    Mar 4, 2011
    Posts:
    45
    Something that I've noticed is that a model which appears upright in Blender will also appear upright in Unity; however, everything looks fine until you try to tap into the local direction vectors like transform.forward and transform.up, strange things happen. So the cylinder with the "unapplied rotation" in your tests may very well possess different direction vectors in relation to the cone, which does have the applied rotation.
     
  34. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,670
    Technolithic: Cross post. Looks like I was editing mine while you posted yours.

    Yes, you need to look at the transforms of the child meshes directly if you are applying forces or moving the transforms of the child meshes directly. The forces/actions you apply to a mesh directly will be related to the transform of that mesh. It won't be a mystery, you just need to look at the actual object you are moving. If you are moving the parent GameObject, then all the children should follow based on the movement of the parent.
     
  35. ScriptGeek

    ScriptGeek

    Joined:
    Mar 4, 2011
    Posts:
    45
    Sorry about the cross post. This is very interesting! After pondering all of this new information, I actually have discovered it to be decently workable. Thanks for the ingenious solution, guys!
     
  36. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,670
    No probs with the cross post! What I meant was that I had the edit window open when you posted, and it took me a long time to actually finish it, so I hadn't seen that you'd posted.

    If it were me, I would probably try the trick on every mesh I created and try not to make too many independent meshes; otherwise each additional mesh will come thru as a child with a Unity mesh correction of -90*x. If you don't care about the Unity mesh correction of -90*x, then there is little reason to do this trick as ALL of the meshes will come in with a Unity mesh correction of -90*x by default if you just import the model without doing anything (at least with the .blend saved to asset folder pipeline).

    I'm going to amend my experiment:

    Picking up where the experiment above left off:

    When the cylinder is imported by Unity, it has the correct orientation:


    The parent GameObject is correct, as expected (it's created by Unity):


    The wedge has the correct orientation due to the unapplied rotation "trick":


    The cylinder does come in with a Unity axis fix (as no "trick" has been applied):


    This is little different from the expected Unity axis fix with a parent GameObject and adjusted meshes.

    To fix both the wedge and the cylinder, the same trick must be applied to both. If one were to return to Blender and rotate the cylinder, apply the rotation and then rotate back and not apply the rotation, then save...

    The meshes are the same in Unity:


    But the transforms are all set to the x,z plane with y up:


    So:

    Summation:

    My gut instinct was correct *and* I was surprised!

    I was correct in feeling that if this "trick" wasn't applied to every mesh, they wouldn't be imported into Unity with correct mesh orientation.

    I was surprised that two meshes, one with the "trick" applied and one without the "trick" applied showed up in Unity both with correct or corrected orientations - but they do.

    Ultimately: The usual method of using a model is to have it follow a parent GameObject, so you don't need to correct each mesh as long as they are in the proper arrangement in the model app space. Move the parent GameObject and have the children follow along. If you need to have each mesh absolutely in xz, y up orientation without having Unity fix them, you will have to apply this trick to each mesh.
     
  37. Robert_Duffill

    Robert_Duffill

    Joined:
    Apr 12, 2010
    Posts:
    162
    You mean return to Blender right?
     
  38. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,670
    FIXED! Thanks for catching that.
     
  39. Glark

    Glark

    Joined:
    Jul 16, 2012
    Posts:
    1
    Yes! I am just running into this oddity of a problem too.

    So, Little Angel, if I am reading you correctly, the best fix or best method for importing things from Blender into Unity is to: Import them in sideways(default blender axis) and then nest them into a empty GameObject that, when rotated, will orient them in the correct direction? Then further nesting that GameObject into whatever class it may be(Enemies, Pickups, Bullets, Etc).

    But my question is this: Do I instantiate the GameObject instead of the mesh? I had this problem a while ago and all my Bullets always shot out rotated, I then just ended up using sphere_pellets. Thanks so much!
     
  40. Viilettaja

    Viilettaja

    Joined:
    Dec 10, 2012
    Posts:
    3
    Howdy guys,

    Any new solutions to this problem? I was able to move objects from blender to unity on some level. Objects look ok but I think something is still off. I connected charactercontroller and simple wasd moving script with rotation to left and right and speed forward. This is where the model did not work. Rotation was ok but it did not move. After rotatint the object I could get it to move but only towars high heavens.

    Now going with empty object which has my model as a child. Seems to move like it should but I afraid this will bite me in the butt later.

    If any new development on this issue please let me know. Thanks for the tips above :)
     
  41. DirgMcCune

    DirgMcCune

    Joined:
    Mar 28, 2013
    Posts:
    1
    Thanks so much for this fix!
     
  42. Staross

    Staross

    Joined:
    Jan 6, 2013
    Posts:
    51
    This is quite annoying, is it really that hard to do an importer that takes into account to coordinate system differences between unity and blender ?

    Edit: I started from scratch my blend file, and check the different steps, the x-rotate trick on the armature did the trick, I think.
     
    Last edited: Apr 2, 2013
  43. aaronsullivan

    aaronsullivan

    Joined:
    Nov 10, 2005
    Posts:
    984
    I just came to most of this solution on my own, but didn't think to rotate everything back 90 degrees on the x axis at the object level. Nice solution!

    Since Unity already recognizes the blend format it DOES seem like it wouldn't be too challenging to fix this up. Blender has turned out to be a great solution for game modeling now that it has matured and I'd love to see the last bit of inconvenience taken care of.

    One problem is that upgrading would make all your models mess up, right? I guess that would be part of the project upgrade process for all the .blend files?
     
  44. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,670
    TBH: I think this has to do with the fact that most solutions are ultimately FBX under the hood. How I understand the import path, when dealing with proprietary files (.blend, .max, etc...) - Unity runs the native application in the background and does an FBX export and then imports the FBX into Unity. I'm unclear why the contents are not then rotated 90° and saved, but I assume there is some risk or issue with doing this.
     
  45. RhinoFlip

    RhinoFlip

    Joined:
    May 7, 2013
    Posts:
    3
    This solution works. I have object from provider but i need more complex yet easy collider. But when i export it from blender, when i drag and drop mesh to mesh collider, axis is rotated. Thank you very much!
     
  46. J_P_

    J_P_

    Joined:
    Jan 9, 2010
    Posts:
    1,021
    Sorry to bump an old thread, but is there a good reason why Unity's .blend importing doesn't handle the conversion for us? Using a empty parent is not ideal.
     
  47. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,670
    Well, technically it does... Unity adjusts the model by -90° on the x-axis... :-/

    You can physically rotate the model in Blender so that the model in Blender matches the Unity work-space...

    But this work-around seems to be the most common one. I believe there is another thread here about someone who made a Blender python script to change the Blender-Unity pipeline, but iirc, this is only adjusting all of the meshes as detailed in this thread, only in script form.

    You can add your votes to the freedback thread on the subject!
     
  48. J_P_

    J_P_

    Joined:
    Jan 9, 2010
    Posts:
    1,021
    Yeah the problem comes when I want to grab the transform.up of a mesh created in Blender. I'm currently grabbing the forward instead, but I just don't like the inconsistency.
     
  49. Deygus

    Deygus

    Joined:
    Aug 14, 2010
    Posts:
    51
    The easiest way to avoid this problem from what I've found after playing around with it is to Export your .Blender File as a .Obj File then Import that into Unity and you'll see it doesn't have this problem. It's obvious that this happens with something in the .Blender not reading when converted to a Unity Asset to use so you pretty much have to play around with the settings it seems according to others. The only downside I've found from doing this is that it makes quick-edit to update Unity Asset a slight problem since you have to do a little more work if you changed the original model any which forces you to have to resave, re-export, and save over the object to update it but it's not really much harder and gets you past this problem.
     
  50. Zurra

    Zurra

    Joined:
    Oct 24, 2013
    Posts:
    6
    As pointed once in this thread earlier, easiest solution is to use
    https://twitter.com/Wahooney/status/179211062669877248

    It's a bit outdated so you need to cha.... I just upload the fixed version for you guys.
    http://www.pasteall.org/46730/python

    Here it is! It works. Now if you re-export your current models you already have placed in unity, you need to fix all of them because the rotation is now 0,0,0. Your models, which are in the unity scene will still have rotation -90,0,0 also your models are facing opposite direction than with blender's own fbx exporter.

    I've had a lot, over hundreds of models which I needed to correct I could have just wrote unity script which automates the process but I decided to to it manually. You need to subtract 180 from your Y rotation and subtract 90 in your X rotation from your unity scene models.
    In my case, I needed to fix alot of models so if my old rotation was:
    -90,0,0 change it to 0,180,0
    -90,90,0 change it to 0,-90,0
    -90,180,0 change it to 0,0,0
    -90,270,0 change it to 0,90,0

    If you old X rotation was 0, just change it to -90 and so on.
     
    Torigas likes this.