i have a parent object that contains mixed childs of different rotations, (treetrunk and branches) i want to rotate the parent so that the main child, the tree trunk looks straight upwards.
If tree trunk points towards Vector3 ( 3,6,8);
how can i rotate parent object so that tree trunk points to Vector3.up ?
Idk why you would do this but wouldn’t you just rotate the parent, (x-3,y-6,z-8)? One of those may need to done again depending on the way the tree is facing though.
Ok this works for certain and it is easy to visualise… find a perp vector to the from and to that you want, and rotate the GO by x degrees around the perpendicular axis:
cross = Vector3.Cross(Vector3.up, trunkispoiting);
angle = Vector3.Angle(Vector3.up, trunkispointing);