如何改变物体坐标
原来我是使用这种方法来转换一个物体的位置的
但是我发现camera移动的时候这个物体就没有移动,那怎么做才能只改变它的物体坐标呢?
void CALLBACK OnFrameRender( IDirect3DDevice9* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext ){ HRESULT hr; pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB( 0,255,255 ), 1.0f, 0 ); pd3dDevice->SetRenderState(D3DRS_LIGHTING, false); if (SUCCEEDED(pd3dDevice->BeginScene())) { model.Render(pd3dDevice); pd3dDevice->SetTransform(D3DTS_WORLD, &m) ; room.Render(pd3dDevice);//***************************************************** D3DXMATRIX world = *MyCamera.GetWorldMatrix() ; pd3dDevice->SetTransform(D3DTS_WORLD, &world) ; // Set view matrix D3DXMATRIX view = *MyCamera.GetViewMatrix() ; pd3dDevice->SetTransform(D3DTS_VIEW, &view) ; // Set projection matrix D3DXMATRIX proj = *MyCamera.GetProjMatrix() ; pd3dDevice->SetTransform(D3DTS_PROJECTION, &proj) ;//***************************************************** pd3dDevice->EndScene(); }}void CALLBACK OnFrameMove( double fTime, float fElapsedTime, void* pUserContext ){ MyCamera.FrameMove( fElapsedTime ); D3DXMatrixRotationY( &m, 45 ); }