Archived

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

Controlling the Cameras.....

This topic is 5379 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

Hey all Hmmm I was just wondering about displaying .X files on screen and how to position them on screen. Basically what Im doing is loading the .X file, this is working fine. and it displays it onscreen. Which is cool The ,X file is a weapona and I would like to position it at the bottom of the screen. But I cant seem to get it to work. So with in the Render function I call the following method to set up the camera void CGame::Setup3DCamera() { //Here we will setup the camera. //The camera has three settings: "Camera Position", "Look at Position" and "Up Direction" //We have set the following: //Camera Position: (0, 15, -50) //Look at Position: (0, 0, 0) //Up direction: Y-Axis. D3DXMATRIX matView; D3DXMatrixLookAtLH(&matView, &D3DXVECTOR3(0.0f, 0.0f, -20.0f), //Camera Position &D3DXVECTOR3(0.0f, 0.0f, 0.0f), //Look At Position &D3DXVECTOR3(0.0f, 1.0f, 0.0f)); //Up Direction m_pD3DDevice->SetTransform(D3DTS_VIEW, &matView); //Here we specify the field of view, aspect ratio and near and far clipping planes. D3DXMATRIX matProj; D3DXMatrixPerspectiveFovLH(&matProj, D3DX_PI/4, 1.25f, 1.0f, 2000.0f); m_pD3DDevice->SetTransform(D3DTS_PROJECTION, &matProj); } But for the life of me I cant figure out how to correctly postion the weapon. At its current postion its of in the distance and pointing up, Do I need to use transformation to align the weapon int the right order or what??? Any help would be much appreciated. Cheers

Share this post


Link to post
Share on other sites
You will need to create rotation and translation matrices, then do a SetTransform before you render the mesh. Look up matrices in the DirectX help, and search online. Functions are provided that make creating the matrices very easy.

Share this post


Link to post
Share on other sites