Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Terrain Editor Adds The Trees in Wrong Rotation (Custom Trees Made With Blender)

Discussion in 'Editor & General Support' started by kaancetinkayasf, May 19, 2021.

  1. kaancetinkayasf

    kaancetinkayasf

    Joined:
    Feb 20, 2020
    Posts:
    10
    I'm using version 2020.3.4, and I'm trying to place my custom trees using the terrain editor. I've been struggling to fix this issue for days but could not find a solution.

    I tried to change the prefab's rotation but didn't work.

    And also, even if my model includes LOD group and mesh renderer, unity gives me a warning in Terrain Panel that says:

    error.png

    I don't know if this is the reason that makes my trees placed in a wrong rotation while using the terrain editor.

    When I place some trees with the brush it looks like this:

    4.png

    And here are all details of my tree model:

    1.png

    2.png
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,160
    This might be because your scene includes the default camera and lights. Unity started importing those with its default Blender import script starting sometime in Unity2019 and it will break a lot of prefabs.

    You can either a) remove the Camera and Light and everything except the LOD group objects (properly named), or you can modify the Blender import script embedded in Unity. This means you would need to re-modify it every time you switched to a new version of Unity, but I was lazy and I do this. Here's more about that idea:

    Blender3D import FBX:

    https://forum.unity.com/threads/from-blender-to-unity-problem.1073381/#post-6925811

    The script that Unity uses:

    ./Hub/Editor/2020.2.1f1/Unity.app/Contents/Tools/Unity-BlenderToFBX.py


    More on fixing it:

    https://forum.unity.com/threads/all-my-mesh-folder-content-is-gone.1102144/#post-7094962

    Blender is a right-handed coordinate model, Unity is a left-handed.

    When you import any Blender object you'll see its rotation is (-90, 0,0) (or close to that).

    To get a tree working with terrain, the tree must be modeled to look upright when rotation is (0,0,0) in Unity.

    Try making your tree in Blender so that "up" is actually +Y on Blender's coordinates (green line positive).

    This basically involves:

    - load your tree
    - enter EDIT mode (not OBJECT mode!)
    - select all
    - make sure your pivot is correct (probably should be (0,0,0))
    - rotate geometry -90 on X (keys are R X -90)
    - leave EDIT mode
    - save the laid-down tree

    That tree should paint properly with Unity terrain.

    TreeInBlender.jpg
     
    Last edited: Jan 16, 2022
  3. kaancetinkayasf

    kaancetinkayasf

    Joined:
    Feb 20, 2020
    Posts:
    10
    Thanks, that solved my problem
     
    Kurt-Dekker likes this.
  4. Arrow591988

    Arrow591988

    Joined:
    Dec 17, 2021
    Posts:
    31
    I’m in the editer I added tree won’t do anything when I click
     
  5. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,160
    Zoom in tight to the point on the ground where you clicked... it's probably densely forested when you get up close.

    Remember LOD...
     
  6. Arrow591988

    Arrow591988

    Joined:
    Dec 17, 2021
    Posts:
    31
    What new to this