Hi
When units are hit, they display their healthbar next to them for a little while. It can be draw2dRectangle or draw2dImage I guess, thats fine, but how to position it correctly? Or other symbols that shall be drawn in the game?
That functions position is relative to the screen, not the world, so if camera can zoom and move, drawing that 2drectangle at the right spot is pretty tricky...
Thank you
How to draw a healthbar in 3d?
Billboards
Hi, you can try using billboards.
regards
Xico
regards
Xico
you can either use
- ISceneManager::getScreenCoordinatesFrom3DPosition(vector3df(x,y,z));
and then draw 2D image above the head
- billboards
the billboard will decrease in size when you go far from the character, and the GFX will be less readable because stretched. It's also not the best thing if you need to write text (you need to create a texture and then render it). With the first method, you can write also text easily as 2D render function in screen coordinates.
- ISceneManager::getScreenCoordinatesFrom3DPosition(vector3df(x,y,z));
and then draw 2D image above the head
- billboards
the billboard will decrease in size when you go far from the character, and the GFX will be less readable because stretched. It's also not the best thing if you need to write text (you need to create a texture and then render it). With the first method, you can write also text easily as 2D render function in screen coordinates.
getScreenCoordinatesFrom3DPosition seems to be a good sollution, although it is SceneCollisionManager (finally figured it out and how to fetch it via sceneManager).
Im having problems getting billboards to work, how do I "start" them, shouldnt load a bitmap or texture onto them? The reference doesnt help me.
Thanks
Im having problems getting billboards to work, how do I "start" them, shouldnt load a bitmap or texture onto them? The reference doesnt help me.
Thanks
Read the collision tutorial, there is a billboard used in that tutorial, and it outlines how to load and display one clearly in code.Beam wrote:getScreenCoordinatesFrom3DPosition seems to be a good sollution, although it is SceneCollisionManager (finally figured it out and how to fetch it via sceneManager).
Im having problems getting billboards to work, how do I "start" them, shouldnt load a bitmap or texture onto them? The reference doesnt help me.
Thanks