我有一个观点,我想要像时钟中的秒针一样旋转对应于每一秒钟,它应该每秒旋转6度但是我尝试计时它并且它不需要花费一分钟来完成旋转,这是代码
void rotate(const float& ox, const float& oy, float &x, float &y, const float& rotation) {
float tx = x-ox;
float ty = y-oy;
float nx = tx*cos(rotation) - ty*sin(rotation);
float ny = tx*sin(rotation) + ty*cos(rotation);
x = nx+ox;
y = ny+oy;
}
float origx = 1280/2, origy = 720/2, pntx = origx, pnty = origy-300, rotation=6; // variables
rotate(origx, origy, pntx, pnty, rotation*timer.delta); // update point, timer is an object that gets the delta time between frames of the main loop