Hell,I need some help with this
I am trying to make a box and place a camera
in that box.
The position of the camera is fixed so it can't move.
All I want to do is to look around.
Well, I made a box and placed a camera.
I can even look around but I dont think this is the way to
do it really. So plz take a look at my code.
if (keys[VK_UP])
{
angleYZ += 0.002f;
lookPos=1;
}
if (keys[VK_DOWN])
{
angleYZ -= 0.002f;
lookPos=1;
}
if (keys[VK_RIGHT])
{
angleXZ -= 0.002f;
lookPos=2;
}
if (keys[VK_LEFT])
{
angleXZ += 0.002f;
lookPos=2;
}
void calcLookPos(int lookPos)
{
switch(lookPos)
{
case 1:
{
lookX = (aLine * cos(angleYZ)) * cos(angleXZ);
lookZ = (aLine * cos(angleYZ)) * sin(angleXZ);
lookY = aLine * sin(angleYZ);
break;
}
case 2:
{
lookX = (aLine * cos(angleYZ)) * cos(angleXZ);
lookZ = (aLine * cos(angleYZ)) * sin(angleXZ);
break;
}
}
}
//in DrawGLScene
gluLookAt(1.0f,16.0f,-1.0f,lookX,lookY,-lookZ,0.0f,1.0f,0.0f);
With my way, I cant handle if a user pressed
up key and down key at the same time.
I feel like I am using the dumpest mathematical method.
Any idea?
[edited by - iamtio on May 17, 2002 6:08:51 PM]
[edited by - iamtio on May 17, 2002 6:10:12 PM]