Archived

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

Prairie

World translation and rotation problem

Recommended Posts

Prairie    122
okay here''s the situation. I have a model I loaded into my program. Within the main render loop I call a function to translate(using global posistion variables from an input function for location), rotate and then render my model. When I just translate it it works fine (the input variables work like they should). However, when I then apply a rotate the directions are all screwy. for instance: the ZPos would now control the Y Axis location?? I''m very confused, any help would be greatly appreciated. Oh yeah, I am using the D3DUtil_ functions for my manipulations (incase that matters). -Prairie

Share this post


Link to post
Share on other sites
X-Man    122
You might be confusing your "up" and "in" directions between model space and world space, like I did originally. Verify that "Y" points "up" in all cases...

Share this post


Link to post
Share on other sites
Prairie    122
Here''s the code for the models render routine, once again thanks

-Prairie

void RenderShip()
{
//SetUp General ID Matrix
D3DMATRIX mat;
D3DUtil_SetIdentityMatrix(mat);

//First Translate the Ships Posistion, Y axis is a
//constant
D3DMATRIX ShipPos=mat;
D3DUtil_SetTranslateMatrix(ShipPos,XPos,5,ZPos);

//Second Rotate the Ship
D3DMATRIX matRotXAxis=mat;
D3DUtil_SetRotateXMatrix(matRotXAxis,1.560f);

D3DMATRIX matPlayer=mat;
D3DMath_MatrixMultiply(matPlayer,ShipPos,matRotXAxis);
g_pD3DDevice->SetTransform( D3DTRANSFORMSTATE_WORLD,
&matPlayer);

XFileShip->Render(g_pD3DDevice);

//Set world back to original
D3DUtil_SetIdentityMatrix(mat);
g_pD3DDevice->SetTransform(D3DTRANSFORMSTATE_WORLD,&mat);
}

Share this post


Link to post
Share on other sites