I'd like to disable one angle of rotation of an object rotating in 3D space. Imagine a camera rotating around and displaying objects as they are in space. I'd like this object to be fixed on the horizontal axis (always in the center of the camera view) and follow the camera rotation on other two angles ( yaw and pitch).
Before multiplying the position matrix with the view matrix, I tried to anull the roll rotation by extracting Euler angles from the view matrix and then recreating it with roll value of zero. Something along these lines:
- Take view matrix and extract Euler angles
- Create the same matrix by replacing roll with zero
It's giving somewhat strange results, and there must be a better way to do this.