我想实现一个跟随我的 3D 对象(汽车)的相机。要设置相机,我使用以下结构:
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45, 1, -5, 5);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(pos_x + (cos(90)*0.5), pos_y + (0.5*sin(90)), 8, pos_x, pos_y, 6, 0, 1, 0);
//pos are the coordinates of the car
我的问题是当我换成那个摄像头时,摄像头不会留在车后,而是在车顶上。为什么?