2d label following 3d object?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
silex
Posts: 6
Joined: Thu Nov 17, 2005 1:39 am

2d label following 3d object?

Post by silex »

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
SARIN
Posts: 139
Joined: Fri Oct 29, 2004 3:53 am

Post by SARIN »

not sure if its wat ur looking for, and its been a while since ive been programming, but u mihgt wnt to look at position2d<s32> ISceneCollisionManager::getScreenCoordinatesFrom3DPosition ( core::vector3df, ICameraSceneNode* )
silex
Posts: 6
Joined: Thu Nov 17, 2005 1:39 am

Post by silex »

thanks, that sounds like what i would need.

now, can anyone elaborate on if irrlicht supports something like transparent texture mapped fonts?
Delan
Posts: 24
Joined: Sun Nov 06, 2005 10:46 am
Location: Polend
Contact:

Post by Delan »

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
dhenton9000
Posts: 395
Joined: Fri Apr 08, 2005 8:46 pm

Post by dhenton9000 »

try a billboard node attached to the object.
silex
Posts: 6
Joined: Thu Nov 17, 2005 1:39 am

Post by silex »

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
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

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.
Image Image Image
silex
Posts: 6
Joined: Thu Nov 17, 2005 1:39 am

Post by silex »

That seems like a good option except I don't have access to a Windows platform to use the font tool. Is there another way?
Post Reply