我正在使用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