z-axis cirkular rotation, with a fixed lookat spot
This is what controls the gamera system so far, It works fine... but now It''s time to add cirkular rotation around a z-axis, and this I don''t know how to do.....
(this is the camera code so far)
GLdouble eyex, eyey;//, eyez, centerx, centery, centerz, upx, upy, upz;
GLdouble eyez = 5.0f;//-atimer;
GLdouble centerx = 5.0f;
GLdouble centery = 5.0f;
GLdouble centerz = 0.0f;
GLdouble upx = 0.0f;
GLdouble upy = 0.0f;
GLdouble upz = 1.0f;
........................
gluLookAt(eyex, eyey, eyez,
centerx, centery, centerz,
upx, upy, upz);
eyex = centerx;
eyey = centery-5.0f;
........................
if (keys[VK_LEFT]) centerx-=0.05f;
if (keys[VK_RIGHT]) centerx+=0.05f;
if (keys[VK_UP]) centery+=0.05f;
if (keys[VK_DOWN]) centery-=0.05f;
if (keys[''A'']) eyez+=0.05f;
if (keys[''Z''])
{
if (eyez <= 0.1f)
{
eyez = 0.1f;
}
else
{
eyez-=0.05f;
}
}
........................
So now I need help with z-axis camera rotation, or course the camera will look at a designated coord all the time...
I''m using Dx so you''ll have to translate yourself:
I think that''s everything you need to do doom style movement.
Magmai Kai Holmlor
- The disgruntled & disillusioned
|
I think that''s everything you need to do doom style movement.
Magmai Kai Holmlor
- The disgruntled & disillusioned
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
I wasn''t aiming at doom style looking and moving, this camera is more like "Ground Controls" camera. The camera is focused on looking at for example, "x = 10, y = 25, z = 0". What I want when rotating is rotating around that x and y focus. I know about using:
..........
degre += 0.1f;
eyex = eyex + (float)sin(degre);
eyey = eyey + (float)cos(degre);
..........
But that will only move the camera in a circular movement pattern, but what I want is for this rotation center is to be the focus''s x and y coord.
..........
degre += 0.1f;
eyex = eyex + (float)sin(degre);
eyey = eyey + (float)cos(degre);
..........
But that will only move the camera in a circular movement pattern, but what I want is for this rotation center is to be the focus''s x and y coord.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement