Jump to content
  • Advertisement

Archived

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

DumbBill

Billboard woes

This topic is 5657 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m just about at the end of my wits from reading my code over and over again trying to solve this problem. I''ve copied code off this forum, from the sdk examples.... it just won''t work. My billboards are rotating to face the camera, but they do not retain their world positions!!! I''ve put in the little translation bit, and it doesn''t seem to make a lot of difference. They just slide around whenever the view is rotated. Please, can anyone help a man in dispair. My code looks something like this: D3DXMATRIX matTransposed,matView; D3DXMatrixIdentity(&matTransposed); D3DXMatrixIdentity(&matView); //get the current view matrix matView = g_pCamera->GetViewMatrix(); //get the transposed matrix D3DXMatrixTranspose(&matTransposed, &matView); matTransposed._14 = matTransposed._24 = matTransposed._34 = 0.0f; // do rendering for (int t=0; tm_vPosition.x; matTransposed._42 = m_pTrees[t]->m_vPosition.y; matTransposed._43 = m_pTrees[t]->m_vPosition.z; g_pd3dDevice->SetTransform( D3DTS_WORLD, &matTransposed ); if (FAILED(m_pTrees[t]->Render())) return E_FAIL; }

Share this post


Link to post
Share on other sites
Advertisement
The billboard matrix in the inverse of the camera matrix, not the transposed matrix.

HTH
Laurent -- http://www.jeux-directx.com/

Share this post


Link to post
Share on other sites
Instead of placing the x,y,z of your trees into your transposed matrix, I think this may work:

D3DXMATRIX matWorld;
D3DXMatrixTranslation(&matWorld, m_pTrees[t]->m_vPosition.x, m_pTrees[t]->m_vPosition.y, m_pTrees[t]->m_vPosition.z);

D3DXMatrixMultiply(&matWorld,&matTransposed,&matWorld);
g_pd3dDevice->SetTransform(D3DTS_WORLD, &matWorld);

Share this post


Link to post
Share on other sites
is directdraw totaly dead? cause im using dx7 still but i heard about those billboard used with direct3d and i was wondering if it was a better way to do 2d?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!