Hi,
Does the Irrlicht engine provide an easy way to display a label following a 3d object? I'm looking for something like OpenGL's gluProject(...), but possibly easier to use? I had a quick look through the examples but didn't see anything there (it's possible I missed it).
Ideally the text would be transparent, not an opaque block. Also, the method needs to scale to several viewports (I don't think this would be an issue).
Can someone throw some Irrlicht functions at me or point me to somewhere that would get me started?
Cheers,
Nick
2d label following 3d object?
you may also use
Code: Select all
// in initing
ITextSceneNode *napis=irrSceneMgr->addTextSceneNode(fontname, L"Nazwa", video::SColor(255,255,255,255), 0);
.
.
.
// in game
napis->setPosition(scenenode->getPosition()); napis->setText(L"ble ble ble");
And time has come now to ride
before the end of the night
the march of the swordmaster
to the unholy fight
before the end of the night
the march of the swordmaster
to the unholy fight
-
- Posts: 395
- Joined: Fri Apr 08, 2005 8:46 pm
I tried adding a TextSceneNode and making it follow the object in 3D space, however the text appears way to small. Looking at the doxygen documentation I couldn't find a method to scale the text; is there a way?
Either way, I would rather the size of text remain the same regardless of the object's distance from the camera, which means finding the screen coordinates from the object's 3D location. Using the method suggested by SARIN I can get a screen position, but I need a way to take into account multiple viewports.
Is there a way using the same function or do I need something else?
Cheers,
Nick
Either way, I would rather the size of text remain the same regardless of the object's distance from the camera, which means finding the screen coordinates from the object's 3D location. Using the method suggested by SARIN I can get a screen position, but I need a way to take into account multiple viewports.
Is there a way using the same function or do I need something else?
Cheers,
Nick
Here's how to change the size of the font used by the text scene node. And it will stay the same how ever far you are from the node.
env->getSkin()->setFont(env->getFont("font.bmp"));
You can use the font tool in the tools folder in the irrlicht directory to create a bmp of a suitably sized font and then do that.
env is the IGUIEnvironment.
env->getSkin()->setFont(env->getFont("font.bmp"));
You can use the font tool in the tools folder in the irrlicht directory to create a bmp of a suitably sized font and then do that.
env is the IGUIEnvironment.