Search Unity

Blender files and the problem with the z-up koordsystem

Discussion in 'Asset Importing & Exporting' started by Kerosini, Apr 5, 2018.

  1. Kerosini

    Kerosini

    Joined:
    Aug 16, 2014
    Posts:
    13
    Hi,

    I using blender and untiy for a couple of years now and since the first days I'm confronted with the unsadisfied workflow to fix the axis-problem.

    Blender using a z-up coordinate system and unity a y-up. So every imported thing as to be rotated by the x-axis for -90°. Unity rotate .Blend models automatically so for the first it seems to be fine. But if you turn the model now around an other axis by eulers the rotation is wrong.

    Now I have a few work arounds or ideas but they all have problems or they are not possible, her comes the list:

    Setting Blender to a y-up coord system
    The nicest solution i think.
    Problem:

    I can't find a way to do this.

    Creating models in Blender allready rotated
    Problem:
    Unity rotates it again, so I have to fix it manualy for each object.
    It is a brainfuck to create everything rotated. If I rotate the model in Blenders editmode after all it will be a brainfuck if I change something.

    Creating a parent transform around the rotated blender model
    The euler rotation problem can be solved if I put it in an other transform and aply every rotation on that.
    Problem:

    Extra work, risk of mistakes.

    Creating a custom importer
    This is my new idea to improve the workflow. If you click on a .blend file in your project assets you see the editor in your importer. Unity is not using blender files, it is translating them to something else. So if there is way a to change this importer I could turn the mesh around the x-axis and not the transform. Has some one of you an idea how I can change the importer in unity?

    Who are you handle this problem?
     
    phobos2077 likes this.
  2. SnowInChina

    SnowInChina

    Joined:
    Oct 9, 2012
    Posts:
    204
    have you tried setting up an fbx or obj export from blender ?
    you can set up all the axis on the exporter to match unity
     
  3. kburkhart84

    kburkhart84

    Joined:
    Apr 28, 2012
    Posts:
    910
    Honestly, I really think the best way to do it is with the parent transform. You get used to doing things that way...and its not actually a bad thing to have the rendered object be a child of the parent object, as you can then add colliders and scripts to the parent object. This allows you to easily change the child object up if you want to, duplicate it to get a head start to creating other objects, etc...
     
  4. lejean

    lejean

    Joined:
    Jul 4, 2013
    Posts:
    392
    Check the experimental apply transform button when exporting to fbx.
    -Z forward, Y up
    Rotation is fixed
     
    XiaoTN, marcospgp, jeromeWork and 2 others like this.
  5. Kerosini

    Kerosini

    Joined:
    Aug 16, 2014
    Posts:
    13
    Ok, fine, thank you for your replies. I hoped some one has a better solution than mine, but it seems that I use the best way(s) allready. I try to use always the .blend file without exporting to fbx, because I don't like so much files, but if you export to fbx you can handle the axises very easy. Thank you for that hint.
     
  6. SnowInChina

    SnowInChina

    Joined:
    Oct 9, 2012
    Posts:
    204
    its not that big of a deal, just create a fbx export preset and you are done
     
  7. lejean

    lejean

    Joined:
    Jul 4, 2013
    Posts:
    392
    Even though using the blender file might seem like a logical option cause you can alter it etc, this only works if you only use that exact model and no other meshes that you hide or put on other layers, cause everything is visible. So ye the correct option is still exporting to fbx prolly
     
  8. rarebyte

    rarebyte

    Joined:
    Sep 26, 2015
    Posts:
    11
  9. phobos2077

    phobos2077

    Joined:
    Feb 10, 2018
    Posts:
    350
    This apply transform feature is broken if you have more than 2 levels in your object hierarchy.

    As far as I know, there is no export preset that allows to properly export an complex object with animations so that it is properly translated to unity's coordinate system, facing correct direction and without having weird rotation values in transforms of the imported prefabs.

    This is so annoying, one of the most popular 3D modelling software can't be used with Unity correctly without ugly hacking or writing custom importers.
     
    Last edited: Sep 22, 2018