我正在使用glLookAt來控制我的相機視圖。Iphone:OpenGL glLookAt:獲取旋轉角度
我使用下面的代碼來旋轉。
SPEED_TURN是0.16(速度我們把在)
GLfloat v[] = {[self centerAtIndex:0] - [self eyeAtIndex:0],
[self centerAtIndex:1] - [self eyeAtIndex:1],
[self centerAtIndex:2] - [self eyeAtIndex:2]};
[self setCenter:[self eyeAtIndex:0] + cos(SPEED_TURN/2)*v[0] - sin(SPEED_TURN/2)*v[2] atIndex:0];
[self setCenter:[self eyeAtIndex:2] + sin(SPEED_TURN/2)*v[0] + cos(SPEED_TURN/2)*v[2] atIndex:2];
我的問題是,如何我得到相機度角一個const?
我想這
rotAngleDegs = (cos(-SPEED_TURN)*v[0] - sin(-SPEED_TURN)*v[2]) * 180/PI
然而,要620
Speed_turn是一個常量嗎?請幫助:) – Burf2000
你說得對!但它是self.rotation - =(SPEED_TURN/2 * 180)/ M_PI; – Burf2000
然後你可以設置:self.rotation = angleInDegrees; – msgambel