I am trying to change the camera view with mouse movement and want the camera to move around the origin in an arcball fashion without going under the scene; so sort of a dome-like view.
The following works satisfactorily for getting the eye coordinates and making this half-arcball view. I hardcoded a condition in order that I would not be able to view underneath the scene. The consequence of this condition is that instead of going under the scene, the camera will zoom into the center instead. I can't wrap my mind around how to impede the camera from doing this 'zoom'. When I get to the lowest part of the dome view, I'd like to only be able to move left or right. Distance is constant. Any guidance?
void onMotion(int x, int y) {
camX = distance * -sinf(x*(M_PI / 180)) * cosf((y)*(M_PI / 180));
camY = distance * -sinf((y)*(M_PI / 180));
camZ = -distance * cosf((x)*(M_PI / 180)) * cosf((y)*(M_PI / 180));
if (camY < 4)
camY = 4;
glutPostRedisplay();
}