• Advertisement

Archived

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

Name display over a character's head

This topic is 6065 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 need to display a text above a mesh. Something like a name tag right above the character's head, no matter the scale or the location of the mesh. Is there a DX8 function for converting 3D vector to 2D perspective coordination? For example: I want to find the viewport(x,y) of a mesh(x,y,z). Edited by - Toyemann on July 17, 2001 5:39:19 PM

Share this post


Link to post
Share on other sites
Advertisement
Since no one is answering I will. I can not tell you the way to do the 2d-to-3d stuff, but for that particular application you would probibaly be better off doing it another way. By creating a rectangular rotated (always faces the camera) sprite and placing it about the head of teh character. Then create a texture, blit the name onto it, and assign it to the new sprite.

Share this post


Link to post
Share on other sites
Using D3DX, call D3DXVec3Project(), with the position of the mesh. Depending on your mesh, that point might be above his head, below him, or in the center. If the mesh sits directly above the point, just add the height if the mesh to the position''s y component, and then Project().

Z.

Share this post


Link to post
Share on other sites
If speed is an issue:
Take an xyz point right over the character''s head.
Transform that point according to your world/view/perspective matrix. Now it''s in 2D mode. You could draw text using GDI functions (don''t do it!!!!!) or render a square with lit, transformed vertices. This is what I do.

The advantage/disadvantage is that the text will be the same size for something far away or something close.

Also, it''s a lot less math for the computer to do. Instead of rotating/translating/transforming four vertices, you''re only transforming one.

My 2 cents.

Share this post


Link to post
Share on other sites

  • Advertisement