2D bitmaps in 3D

Started by
6 comments, last by Mister Stewart 21 years, 4 months ago
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!"
"16 days?? that's almost two weeks!!" Tucker
Advertisement
How are you applying the scale? Wen you scale something that is not centered about the origin, you translate the point as well..
------------------------------------------VOTE Patrick O'GradyWrite in Presidential CandidateThe Candidate who Cares.
You mean the matrices? I''ll get back to ya on that.



"Sweetie! Get Mommy''s bazooka!"
"16 days?? that's almost two weeks!!" Tucker
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]
"16 days?? that's almost two weeks!!" Tucker
are your verts centered around the geometric middle of your quad? if not the scaling will not work out correctly.
and yes you should scale then tranlate (at least in this case).
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]
"16 days?? that's almost two weeks!!" Tucker
Okay, I fixed it. Thanks all for your help.

"Sweetie! Get Mommy''s bazooka!"
"16 days?? that's almost two weeks!!" Tucker

This topic is closed to new replies.

Advertisement