opengl rotate tangent to a circle
I have an object right now which I have moving in a circle around the vertical (Y) axis. I want to rotate this object so it is always aligned with the tangent of the circle, how do I do this? Not sure what combinatio开发者_如何学JAVAn of sin/cosine/tan to use as the first argument of glRotatef...
Thanks!
The first argument of glRotatef
is the angle, in radians (so 0 is no rotation, PI is flipped around end for end, and 2*PI is rotated all the way back to the original orientation).
You probably could have answered this yourself through trial and error in less time than it took to askk the question.
Note that if you choose the center of rotation to be the center of the circle instead of the center of the object, you won't need a separate translation step.
精彩评论