This topic is now archived and is closed to further replies.

Camera Control HELP!!

This topic is 6114 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Well I have got my camera control to work but sometimes it just messes up completely .. .I can''t imagine what is wrong? I am just trying to move the camera in 2D space ( i.e x & Z plane). I will add the Y later. Help me please!! void CameraControl() { static float ceyex=0,ceyez=5.0f; // eye point static float ctargetx=0,ctargetz=0; // target point static float cincx=0,cincz=0; // present looking direction vector incrementer static int theta = 0; // angle of facing .. const float vel = 0.1f; // velocity of movement const int dist = 5; // dist between eye and target cam.SetEyePoint(ceyex,0.0f,ceyez); cam.SetTargetPoint(ctargetx,0.0f,ctargetz); cam.UseCamera(g_pd3dDevice); cam.CameraTransform(g_pd3dDevice); ceyex = ctargetx + dist*(float)cos(theta * 0.017f); ceyez = ctargetz + dist*(float)sin(theta * 0.017f); cincx = vel * (float)cos (theta * 0.017f); cincz = vel * (float)sin (theta * 0.017f); if (keys.KBInput(DIK_LEFT) == TRUE) { theta--; } if (keys.KBInput(DIK_RIGHT) == TRUE) { theta++; } if (keys.KBInput(DIK_DOWN) == TRUE) { ceyex +=cincx; ceyez +=cincz; ctargetx +=cincx; ctargetz +=cincz; } if (keys.KBInput(DIK_UP) == TRUE) { ceyex -=cincx; ceyez -=cincz; ctargetx -=cincx; ctargetz -=cincz; } }

Share this post

Link to post
Share on other sites