transform and rotate

Started by
12 comments, last by giugio 15 years, 4 months ago
i post the code:
this is the render loop:
I draw only 2 meshes of the 200 meshes vector m_AllMeshes
for(itMesh = m_AllMeshes.begin();itMesh != m_AllMeshes.end();itMesh++)		{			Device->SetMaterial(&mtrl);			CMeshBase* pmesh=((CMeshBase*)*itMesh);			if(pmesh->getName().find("F430-mesh")!=string::npos )			{				vRotationAxis->x = 0.57735f;				vRotationAxis->y = 0.57735f;					vRotationAxis->z = 0.57735f;				matr->LoadIdentity();				matr->RotateAxis(vRotationAxis,-240);				matr->Translate(0.642309f,-0.1489442f,0.442514f);												matr->Push();								Device->SetTransform(D3DTS_WORLDMATRIX(0), matr->GetTop());				pmesh->mesh->DrawSubset(0);			}			if(pmesh->getName().find("B-floor-mesh")!=string::npos)			{										matr->LoadIdentity();				matr->RotateAxis(vRotationAxis,-240);				matr->Translate(0.234062f, -1.04631f,0.148801f);												matr->Push();										Device->SetTransform(D3DTS_WORLDMATRIX(0), matr->GetTop());				pmesh->mesh->DrawSubset(0);										}		}

I call loadidentity before apply the transform and the rotation result is ok ,but there is an error in the location of the 2 meshes
i already test that the values of the translate is correct.
I must use translate or translatelocal?
thanks.
Advertisement
I'm read somewere that in collada in directx i must invert the z coordintate of translation, from Lhc to rhc.
is true?
thanks.
Quote:Original post by giugio
I'm read somewere that in collada in directx i must invert the z coordintate of translation, from Lhc to rhc.
is true?
I'm not familiar with COLLADA myself, but if it is OpenGL-oriented then it's quite likely you'll need to swap between LH and RH coordinate frames.

Usually it is fairly obvious when you've got this part right/wrong so give it a go with both and have a look [smile]


hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

yeah.
I swap the y with the z and now y and z are correct.
The code is the same that i have posted , change only the swap of y and z.
The problem now is on the x coordinate is too big in the second mesh.

and ...
There is a measure unit in my collada file i must change anythings?

This topic is closed to new replies.

Advertisement