billboard problem

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Omberon

billboard problem

Post by Omberon »

Hello,
What I want to do is to have the name of characters in my game displayed over their heads like you see in many mmorpgs. I could be wrong but I think that to do this I should make a billboard and attach the billboard to the mesh and then position the billboard so that it is above the mesh. The only problem is that I don't know how to do that. If anyone could help me that would be great.
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

why not use:

Code: Select all

smgr->addTextSceneNode
as in example 10 (shaders). This way you can attach it to your players and it will be visible from any angle (like a billboard)
Omberon

Post by Omberon »

Ok, thanks, I never thought of that. I'll try it.
Omberon

Post by Omberon »

This works but, when I go behind buildings I can still see the text. That's why I wanted it to be a billboard, it wouldn't be visible through walls.
Omberon

Post by Omberon »

Here is my real problem right now. I'm creating a node with
scene::ISceneNode* billg = 0; and then creating it later on with
billg = smgr->addBillboardSceneNode(mesh, core::dimension2d<f32>(30, 60));
the first parameter, mesh, is the model I want to attach the billboard to. The problem is that I can only attach billboards to other nodes, not AnimatedMeshes. Is there some way to maybe create a node that both the mesh and the billboard use to define their positions maybe? If anyone knows please help.
saigumi
Posts: 921
Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:

Post by saigumi »

You don't pass addBillboardSceneNode the mesh for it's Parent. You pass the sceneNode that the mesh is in.

Code: Select all

virtual IBillboardSceneNode* irr::scene::ISceneManager::addBillboardSceneNode  (  ISceneNode *  parent = 0,  
  const core::dimension2d< f32 > &  size = core::dimension2d< f32 >(10.0f, 10.0f),  
  const core::vector3df &  position = core::vector3df(0, 0, 0),  
  s32  id = -1 
 ) 
Crud, how do I do this again?
Brinsky
Posts: 28
Joined: Sun May 08, 2005 3:05 pm
Location: Slovenia

Post by Brinsky »

Maybe you should try using: mesh->getMesh(0), as the first parameter instead of: mesh. This way (just guessing outloud) the billboard is attached to the first frame of the animated node (and reads it as a static node instead of a dynamic kind). As I said - just a wild guess - if it's wrong someone correct me please!
10 I lovez my computer
20 goto 10
Omberon

Post by Omberon »

I figured it out. First I need to create an AnimatedMeshSceneNode. Then I can attach a mesh to that node and then I can attach the billboard to the AnimatedMeshSceneNode which makes both the mesh and the billboard now connected. The only thing I have to do after that is reposition the billboard so that it's above the mesh's head instead of sticking out of the middle of the mesh. Thanks for truing to help me.
Ishtm
Posts: 37
Joined: Mon May 09, 2005 8:03 pm

Post by Ishtm »

If i dont mistake there is an example of that.... #10 using shaders

good look!
TheRLG
Posts: 372
Joined: Thu Oct 07, 2004 11:20 pm

Post by TheRLG »

hey post a screen of what u have plz, im interested to see how its looking.
Omberon

Post by Omberon »

Sorry I didn't post a screenshot earlier. Here it is:
Image
Post Reply