Rotating the gameobject
I need to rotate a gameobject same value as the "Head" of that gameobject. I create a gameobject in the middle of the screen.
TargetRange.transform.position = Camera.main.ScreenToWorldPoint (new Vector3 (Screen.width / 2, Screen.height / 2, transform.position.z + 100f));
the "Head" of the object looks at the newly created object and the "body" of the gameobject has to turn to the direction of the Head. However, when I insert the rotation value, it does not seem to be value that I inserted.
thePlayer.transform.LookAt (GameObject.FindGameObjectWithTag ("TARGET").transform);
Head.transform.rotation = thePlayer.transform.rotation;
print ("Player:" + thePlayer.transform.rotation);
print ("Head:" + Head.transform.rotation);
Local Rotation of Head:
Local Rotation of the Body:
Help would be great,
Thank you
headrotation.png
(3.6 kB)
playerrotation.png
(3.5 kB)
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612065507im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Problem in build: PC and Android - IsolatedStorageException and pink screen 0 Answers
Move rotating object 0 Answers
How can i make a cannon ball go forward? 1 Answer
Camera rotation error: "Input rotation is { NaN, NaN, NaN, 1.0000 } 0 Answers
how to fix automatic camera rotation when using joysticks? 0 Answers