How do i rotate around an arbitrary axis.

Started by
1 comment, last by _Phalanx_ 18 years, 1 month ago
Hey, i am a bit confused about this whole rotation thing of game programming. How do i rotate a system around an arbitrary axis. I am trying to control my system like a standard fps camera is controled. I think the only way to do this is to rotate around the "up" vector of your camera when turning side to side, and around the "side" vector when i want to look up and down. My question is how do i go about rotating a xyz component vector around another xyz component vector. I have heard quaternions might be my answer but i dont understand these very well. I will go research anything i just need to be shown the right direction.
Advertisement
Forget quaternions -- they are an optimization. The graphics API you are using probably has a function that rotates around an arbitrary axis. In OpenGL, you use glRotate. In D3D, you use D3DXMatrixRotationAxis (or perhaps D3DXMatrixRotationX, D3DXMatrixRotationY, or D3DXMatrixRotationZ) to generate a rotation matrix.

But you say you are confused about rotation in general. Maybe you should learn a little about how linear algebra works. Take a look at the GameDev Books page to find some recommended math books.
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
This engine i am writing is software only and only uses the most basic of sdl routines. the only API i wanna use for this program is blitting and opening a window.

This topic is closed to new replies.

Advertisement