I can't seem to figure out how to get the angle between two game objects. I need the angle on the X,Y plane and the X,Z plane. I was trying transform.eulerAngles.y and transform.eulerAngles.z but there are scenarios where that does not work because if you go around 180 on XZ and then 180 on XY the XZ should be 0 but it stays at 180. What is the best way to get the correct degrees between the two game objects all the time no matter how many times you rotate around the object.
It's a known Isue from early days of 3D animation software development called "gimbal lock" the basic concept is when you rotate on one axis and then try another one, the order is important because sometimes the local rotational axis will be on top of each other and no matter which one you rotate, the object will rotate the same, so, different programs found different solutions for this problem, I think maybe the problem you are face to face is the approach of unity to solve gimbal lock.