# Moving the camera pivot

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

## Recommended Posts

Hi, I hope I can explain this properly.... I am building moving map software for aerial navigation in direct3d. The problem is that the camera focus is the aircraft, and this has to be down the bottom of the screen (say about 1/10th the way up). The camera will defualt to overhead the aircraft pointing down. So I set all this ... and its fine. But the thing is direct3d has the camera centered in the screen and i need it 1/10th the way up and i have no clue how. I have thought of rendering to a larger than screen surface off screen, if this is possible and then cropping the piece I want out and drawing that to screen. But this would use extra of CPU/GPU. Would it be possible to render a certain segment only of the camera view or something like that? I hope this all made sense.

##### Share on other sites
I think I didn't understand you question properly, but this is the way I handle my camera:

D3DXMATRIX View;D3DXVECTOR3vEyePt, vLookatPt, vUpVec(0.0f, 0.0f, 1.0f); // I use the Z-axis as the up and down axis.vEyePt = D3DXVECTOR3(  fX + ((fZoom * (float)cos(fAngle[1])) * (float)sin(fAngle[0])),  fY + ((fZoom * (float)cos(fAngle[1])) * (float)cos(fAngle[0])),  fZoom * (float)sin(fAngle[1]));vLookatPt = D3DXVECTOR3(fX, fY, 0.0f);	D3DXMatrixLookAtLH(&View, &vEyePt, &vLookatPt, &vUpVec);g_pd3dDevice->SetTransform(D3DTS_VIEW, &View);

Explaination:
fX and fY are global floats that define my look at position. vEyePt is the vector where my camera position is defined. In my situation my Eye is able to move freely in a hemispheric space (this might not be interesting to you, it only explains the trouble with those sin/cos functions), it will always look at the LookAt vector.

The D3DXMATRIX View is a matrix I use to store my vectors in, with the D3DXMatrixLookAtLH function and with SetTransform(D3DTS_VIEW, &View) statement I set that as my view.

In your case the fX and fY could be the coordinates for the plane (you should of course add a fZ).

I hope this helps, if you have any further questions, feel free to ask.

##### Share on other sites
You didnt understand me. Say your eye focus's on object X. Then you want that object X 1/10th the way up from the bottom of the screen, and the rest of the screen to contain the foward portion of the cameras view. Kinda like zooming in on the camera view. I was hoping directX would have a way to do this... but since i typed the post ive had second thoughts and may or may not do it cuz it might look un natural, anyways i gotta go start trying stuff out.

• 10
• 18
• 14
• 18
• 15