Im basically a directX noob, and currently learning from pretty cool internet tutorials.
So i read into moving objects and figured out how to rotate and translate objects in World-axis, but how do i translate objects in Objectspace ?
or to be more specific;
How do i translate my Camera relative to its own Z-axis ?
i want to simulate a plane flying forward, but all i get is a "plane" flying towards the z-World-axis.
Heres my function which handles all translations:
void render_frame(void)
{
d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
d3ddev->Clear(0, NULL, D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
d3ddev->BeginScene();
static float forward = 0.0f; forward += 0.01;
static float pitch = 0.0f;
static float roll = 0.0f;
D3DXMATRIX matView;
D3DXMATRIX matMove;
D3DXMATRIX matRotateZ;
D3DXMATRIX matRotateX;
D3DXMatrixTranslation(&matView, 0.0f, 0.0f, forward);
D3DXMatrixRotationZ(&matRotateZ, roll);
D3DXMatrixRotationX(&matRotateX, pitch);
if((!KEY_DOWN(VK_DOWN))&&(KEY_DOWN(VK_UP))) {
pitch-=0.01f;
}
if((KEY_DOWN(VK_DOWN))&&(!KEY_DOWN(VK_UP))) {
pitch+=0.01f;
}
if((KEY_DOWN(VK_RIGHT))&&(!KEY_DOWN(VK_LEFT))) {
roll+=0.01f;
}
if((!KEY_DOWN(VK_RIGHT))&&(KEY_DOWN(VK_LEFT))) {
roll-=0.01f;
}
D3DXMatrixLookAtLH(&matView,
&D3DXVECTOR3 (0.0f, 0.0f, forward),
&D3DXVECTOR3 (0.0f, 0.0f, 0.0f),
&D3DXVECTOR3 (0.0f, 1.0f, 0.0f));
d3ddev->SetTransform(D3DTS_VIEW, &(matView*matRotateZ*matRotateX));
D3DXMATRIX matProjection;
D3DXMatrixPerspectiveFovLH(&matProjection,
D3DXToRadian(45),
(FLOAT)SCREEN_WIDTH / (FLOAT)SCREEN_HEIGHT,
1.0f,
100.0f);
d3ddev->SetTransform(D3DTS_PROJECTION, &matProjection);
meshTeapot->DrawSubset(0);
d3ddev->EndScene();
d3ddev->Present(NULL, NULL, NULL, NULL);
}
Can you help me solving my problem ?
Any Idea or "pointing into the right direction" is highly appreciated ! (as i dont even know how to search without the specific terms...)
additionaly: Do you have any other advises for handling Input ? (mine sure isnt the best.)
(or even other no goes you detect in the above ?)
thank you


















