Hi to the bright persons of stackoverflow, I am facing a particular problem in need of a solution.
I have a transform which I need to point one of its axisaxes in the direction of a another gameobjectgame object, without disturbing or rotating the other axises on anywayaxes in any way.
Consider the way your hips move around on a horizontal plane , while both your upper and lower body rotate to face the hip bonesbone's position, without turning left or right.
How do I achieve the above using unityUnity transforms in C#?
In the attached image, both T1 and T2 need to face the controller anywhere it moves without spinning on its Up axis, meaning its forward axis must always remain forward.
While reviewing my question I see Billboarding as a suggestion. I am asking how to billboard both T1 and T2 to the controller without turning its forward. In this image, both T1 and T2 need to face the controller anywhere it moves without spinning on their Up axis, meaning their forward axis must always remain forward.
Edit:While reviewing my question I see Billboarding as a suggestion. I am asking how to billboard both T1 and T2 to the controller without turning their forward directions.
The problem I am facing comes down to the three axes. If I apply LookAt() to the controller, even if setting the x, y, or z, or both xz or xy or zy to 0, there is no way that LookAt() can point T1 in the right direction along the Z and X axes while ignoring the Y. It is always Z rotation only or X rotation only or undesired Y turning as the result. LookAt is causing the front of the body to face away from the front when the controller moves, I need to lock it to face forward, but tilt side to side and back and forth.
In the second image, see how the waist is moving, both the upper and lower body are pointing to the waist, I am trying to accomplish that with rotations.

