Archived

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

2D bitmaps in 3D

This topic is 5500 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

Hi all. I am hoping you can help me with this latest prob. I am near the end of making my first 3D game, and I am trying to make it so a 2D explosion bitmap appears when a bad guy is killed. Now, this works perfick, but I wanted bigger explosions so I increased the scale (I created a class that has ''scale'' as one of its attributes (explosion.scale += 3)). Now when I play, the explosions occur, but in completely messed up locations, nowhere near where they are supposed to be. The problem is in the scaling - I know that much, and I was wondering, is there a solution that doesn''t involve me having to open the bmp in Paint and increasing the scale myself? I read something about having an orthogonal projection matrix to display 2D objects in 3D - would this help? Your input would be much valued. Thanks. "Sweetie! Get Mommy''s bazooka!"

Share this post


Link to post
Share on other sites
heres the function:


    
void MWS_3DBitmap::set_matrices(LPDIRECT3DDEVICE8 global_device)
{
//translation

D3DXMatrixTranslation(&translate_matrix, move_x, move_y, move_z);

//scaling

D3DXMatrixScaling(&scale_matrix, scale_x, scale_y, scale_z);

//multiply

D3DXMatrixMultiply(&world_matrix, &translate_matrix, &scale_matrix);

//set the transform

global_device->SetTransform(D3DTS_WORLD, &world_matrix);
}//END SET_MATRICES()



Should I change the order the matrices in the multiply function? Or is it something else?

Edit - Nope. Changing the multiplication order made things worse.






"Sweetie! Get Mommy's bazooka!"

[edited by - Mister Stewart on November 22, 2002 11:31:38 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
are your verts centered around the geometric middle of your quad? if not the scaling will not work out correctly.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
and yes you should scale then tranlate (at least in this case).

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
are your verts centered around the geometric middle of your quad? if not the scaling will not work out correctly.


Sorry I do not understand...

Also, regarding doing the scale first, then the translate, I tried it and it did not work.





[edited by - Mister Stewart on November 22, 2002 3:54:17 PM]

Share this post


Link to post
Share on other sites