• Advertisement
Sign in to follow this  

Centering 3d text..

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

Hello. I have an object, and I'm able to dispaly text above the object, using D3DXCreateText, and then transposing the world matrix just above the object. Pretty simple. My problem is that the text is left aligned. I'll try to make a tiny ascii diagram lol.. The 'o' represents where the object is. I have to use '.' for spacers because the forums autoformat the text over to the left side. .....................text appears here .....................o ........I want text to appear here .....................o Any idea how to fix this? My only idea on how to do that would be to find the width of the mesh, devide that by 2, and then shift it over to the left.. Any help would be appreciated. Thanks. Note, I'm billboarding the text so it always faces the correct direction, so that isn't a problem. Adam

Share this post


Link to post
Share on other sites
Advertisement
I usually use:

((width of thing I'm centering over - width of thing being centered)/2) + left edge of thing I'm centering over

-fel

Share this post


Link to post
Share on other sites
Yah, but the problem is that I (cannot/do not know how to) find the width of the mesh that I need to center. =/

Share this post


Link to post
Share on other sites
=/ this hasn't been answered and it was on page 2 so.. I hope its not against the rules to bump a topic.

Share this post


Link to post
Share on other sites
I'm interested in seeing if you can find another way to solve this problem, but I'm pretty sure you can at least examine the vertex data in the mesh that is returned to you. You can construct a bounding box for the mesh extents, and then with that you have your mesh width.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement