Placing tree aligned to planet normal - wrong rotation?


I’m trying to place trees aligned to normal of the planet, which I compute by making a raycast from mouse click point. I understand the math behind this, but still got some problems. The normal vector is correct (white line on screenshot), but trees are still placed in wrong orintation. Could someone look at my code and give some advice?
Thanks in advance :slight_smile:

                if (Input.GetMouseButtonDown(0))
                    RaycastHit hit; ;
                    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                    if (Physics.Raycast(ray, out hit))
                        GameObject obj = GameObject.Instantiate(tree, hit.point, Quaternion.LookRotation(tree.transform.forward, hit.normal)) as GameObject;


OK, actually it seems I’ve answered myself in the meantime. It works with:

GameObject obj = GameObject.Instantiate(tree, hit.point, Quaternion.identity) as GameObject;
obj.transform.rotation = Quaternion.FromToRotation(Vector3.up, hit.normal);

However I still don’t know why previous method generated such strange results. I appreciate if someone could explain it to me :slight_smile: