Original Post
Hi, I have a problem about 2D sprite's. I am using CFirstPersonCamera class for fps camera in directx 9. I am setting the matrix of 3d mesh's like the code below. But it's not working for 2D sprites. After rendering mesh's i am rendering sprites with the code below. But Sprite is follows my camera and rotating with it.I can't set it to a static position.Does anyone has any idea about it. Thanks.
mWorld = *g_Camera.GetWorldMatrix();
mProj = *g_Camera.GetProjMatrix();
mView = *g_Camera.GetViewMatrix();
mWorldViewProjection = g_mCenterWorld * mView * mProj;
RECT srcRect;
srcRect.top = (( nFrame / 5 ) * 64);
srcRect.left = (( nFrame % 5 ) * 64);
srcRect.bottom = srcRect.top + 64;
srcRect.right = srcRect.left + 64;
// LPD3DXSPRITE object g_pDonutSprite
g_pDonutSprite->Begin( D3DXSPRITE_ALPHABLEND );
D3DXMatrixTranslation( &m_SpriteCenter, vPosition.x, vPosition.y, vPosition.z );
mWorldViewProjection = m_SpriteCenter * mView * mProj;
g_pDonutSprite->SetTransform(&mWorldViewProjection);
g_pDonutSprite->Draw( g_pDonutTexture, &srcRect, &vCenter, &vPosition, D3DCOLOR_COLORVALUE(1.0f,1.0f,1.0f,1.0f) );
g_pDonutSprite->End();