Rotation Schemes

Howzit

I’ve got a 3D model that I’ve imported and it’s cool. But now I need to rotate it when I press the relevant arrow key.

I’ve written some methods to rotate it using glRotatef but it doesn’t work perfectly. I need it to be like like a character in Warcraft III. Those characters turn and face what ever position you click. The only difference with mine is that it’s keyboard controlled.

What would be the best way to do this?

Shot

I had some similar problems early on because I didn’t understand how the rotate methods worked in relation to the “root.” (ie, rotate rotates around the root versus the center of the object.)

I’m sure I can’t put it better than they do in the red book. I’d suggest checking out Chapter 3, online here:
http://www.dcc.unicamp.br/~lmarcos/courses/mc603/redbook/chapter03.html#name2