Original Post
I made a camera class like this
so if m_State is CAM_DIRECTION, it will use angular values from the m_XLookat and m_Ylookat to set where to look at (like if you make a doom-like, you just rotate around the y axis with the left and right keys) ... that was easy to code
But, if m_State = CAM_LOOKAT (That specifies a viewing target), the program must fill in m_YLookat and m_XLookAt so the center point of the screen is the target point .. But what are the math, I have a sight idea but dunno exactly. (Ah, yes, my camera must not spin around the Z axit)
All help will be appreciated :o)
(I don't want gluLookAt(...), so...)
Edited by - SKSlayer on 8/25/00 8:34:01 AM
enum CameraState { CAM_LOOKAT, CAM_DIRECTION } ;
class CCamera
{
public:
CCamera();
~CCamera();
SetCamera();
private:
void CheckValues();
int GetAngles();
long double m_Position[3];
double m_YLookat;
double m_XLookat;
long double m_Lookat[3];
CameraState m_State;
};
|