#### Archived

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

# Camera Control HELP!!

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

## 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 on other sites
Hello! anybody .???

1. 1
2. 2
Rutin
20
3. 3
khawk
17
4. 4
A4L
14
5. 5

• 12
• 16
• 26
• 10
• 44
• ### Forum Statistics

• Total Topics
633759
• Total Posts
3013716
×