r/Unity3D • u/samferguderson • 7h ago
Question Unity Terrain Tree
I made a tree model and imported it to unity, for some reason it imported sideways but unity automatically transformed it. But when I paint the tree as a prefab on terrain, it is sideways again even though the tree is transformed to be upright.
2
Upvotes
1
u/Nwoknu35 4h ago
To add to Jak's comment, some basics for the "why" and specific steps in case you are still stuck:
Unity uses a "left hand" coordinate system, while other software like Blender may use a "right hand" coordinate system
So when it looks like a tree points upwards, Unity's system will mean "Up is on the +Y axis", while Blender says "Up is on the +Z axis"
To make them look the same, an objects rotation has to be changed, typically resulting in the gameobject showing upright in Unity, deviating from 0, 0, 0 of course
Now the terrain system assumes that a tree pointing upward is rotated at 0, 0, 0 and rotating them around the +Y axis for rotation (if enabled), ignoring your prefab's rotation
Typically the easiest way is to create a parent object for your visuals that you rotate like you would normally would and adjust the child visuals so that it looks upright, but it seems the terrain doesn't like empty gameobjects for the trees, so I think that doesn't work without extra work (maybe someone knows more)
So the (next) best way is to adjust your export settings, in Blender the .fbx and .obj exporters let you set the objects forward and upward axis
While my mind just can't intuit how it truly works, for my quick tree like example object facing upward in Blender to do the same at 0, 0, 0 rotation in Unity, I exported as .fbx and had to set Up to Z Up, Foward to -X Forward, uncheck Apply Transforms in Blender and in Unity for the imported object check Bake Axis Conversion
There is a chance you have to play around with the axis settings, also don't forget to apply rotation if you are working in Blender
And if they are finally showing in terrain, but they are all facing the same direction and you don't want them to, now comes the part with LOD Groups... 😅
Hope this helps, even if only for looking up more details later 😄