Answer the question
In order to leave comments, you need to log in
How to rotate target parallel to the camera but only on the x-axis?
Hello, in general, there is a Camera that monitors the object and there is a target that is parallel to the camera.
Target is a guide for the sphere (character) tobish sphere is pointed at the target. How to make this target rotate parallel to the camera BUT only relative to the X axis along the rest so that it does not move?
Answer the question
In order to leave comments, you need to log in
If I correctly understood the essence of the question, then the problem is solved in one line. There is a GameObject target and a GameObject camera, the target rotates along with the camera in x.
target.transform.eulerAngles = new Vector3(camera.transform.rotation.ToEulerAngles().x * Mathf.Rad2Deg, 0, 0);
target.transform.eulerAngles = new Vector3(0, camera.transform.rotation.ToEulerAngles().y * Mathf.Rad2Deg, 0);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question