- Home /
How do i get this objects y rotation the same as my cameras y rotation?
I need this object to be the same y rotation as the camera, but i cannot parent it because on all other clients the camera is inactive.
code so far, it only works for the x and z axis,but the y rotation is always zero.
void Update(){
transform.FindChild ("Rainbow_Beam_Particles").transform.localRotation = Quaternion.Euler(0,Camera.main.transform.localRotation.x,0);
}
Answer by seanniekins · May 18, 2017 at 10:14 AM
shouldn't (0,Camera.main.transform.localRotation.x,0)
be (0,Camera.main.transform.localRotation.y,0)
?
That's whats strange, this does not work I have tried that before. Is it because a mouse look script in on the camera?
In the inspector the camera's y rotation seems to be the x rotation. Its very strange
Your answer
Follow this Question
Related Questions
Flip over an object (smooth transition) 3 Answers
Weird shake when I try to rotate player according to Virtual Cameras rotation. 0 Answers
Transform rotation and position on key input: rotation only working the first time 2 Answers
How can i rotate a object more than once (90 degrees)? 1 Answer
Trouble with Camera Rotation Math 2 Answers