Controlling the Cameras.....

Started by
1 comment, last by RonanHayes 21 years ago
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
Advertisement
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.
Cheers

I new I was on the wrong Track.

This topic is closed to new replies.

Advertisement