- Home /
Matching rotation x of game object to OrbitCamera rotationx
Hi guys. I am trying to match the up and down rotation (across x axis) of an object (a water gun) to my orbit camera's rotation x. I ONLY want to match the rotation across that one axis. The problem is, this code I'm using rotates the object along all axises to match the camera: void Update (){ gameObject.transform.rotation.x = OrbitCamera.transform.rotation.x; } Anyone know how to make my object only rotate upwards and downwards with the camera? I want all the horizontal rotation to inherit from the player but all the up and down to inherit from camera
Your answer
![](https://koobas.hobune.stream/wayback/20220612150258im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Restrict camera rotation in x and y? 1 Answer
move the object where camera look 0 Answers
2D camera rotating relatively to game object speed 0 Answers
[JS] Custom camera rotation resets on Var change? 0 Answers
Camera.WorldToScreenPoint Equivalent 1 Answer