Public Group

Archived

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

2D bitmaps in 3D

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

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 on other sites
How are you applying the scale? Wen you scale something that is not centered about the origin, you translate the point as well..

Share on other sites
You mean the matrices? I''ll get back to ya on that.

"Sweetie! Get Mommy''s bazooka!"

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 on other sites
are your verts centered around the geometric middle of your quad? if not the scaling will not work out correctly.

Share on other sites
and yes you should scale then tranlate (at least in this case).

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 on other sites
Okay, I fixed it. Thanks all for your help.

"Sweetie! Get Mommy''s bazooka!"

1. 1
Rutin
25
2. 2
3. 3
4. 4
JoeJ
18
5. 5

• 14
• 14
• 11
• 11
• 9
• Forum Statistics

• Total Topics
631757
• Total Posts
3002125
×