I read some data and construct a scene using geometry. Then, I extract a heading and pitch in degrees and I want to orient the camera to match. My current approach is simply to convert heading and pitch into radians (
roll_radians is always
0.0) and then call:
camera.rotation.order = 'YXZ'; camera.rotation.set( pitch_radians, yaw_radians, roll_radians );
For some instances this works. For some, it appears to be 180 degrees off and for others, some other seemingly random amount. I haven’t been able to spot a pattern - one with a heading of 186 degrees works and one with a heading of 235 needs 90 to be added to it before it’s correct.
I imagine I am either missing something important in my calculation or else, the heading/pitch data is not being decoded correctly.
Hopefully it’s the former (I have no additional insight into the data) - can anyone point me at the right way to do this?