when I add a BillboardTextSceneNode as child of another SceneNode it ignores it's own position !!!

The BTSN is always at the center (pivot) of it's parent...
same for the TextSceneNode !!! :shock;[/b]
Code: Select all
#include <irrlicht.h>
using namespace irr;
int main()
{
// create device and exit if creation failed
IrrlichtDevice* device = createDevice(video::EDT_OPENGL);
if (device == 0)
return 1; // could not create selected driver.
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
gui::IGUIEnvironment* gui = device->getGUIEnvironment();
// a point of reference, just sits at the origin
scene::ISceneNode* ref = smgr->addCubeSceneNode(10.f);
ref->setMaterialFlag(video::EMF_LIGHTING, false);
ref->setMaterialTexture(0, driver->getTexture("../../media/particlered.bmp"));
// a moving parent
const core::dimension2df size(30.f, 30.f);
const core::dimension2d<u32> count(10, 10);
scene::IAnimatedMesh* terrain = smgr->addHillPlaneMesh("plane", size, count);
scene::ISceneNode* tile = smgr->addMeshSceneNode(terrain->getMesh(0));
tile->setMaterialFlag(video::EMF_LIGHTING, false);
tile->setMaterialFlag(video::EMF_WIREFRAME, true);
// a moving text scene node
gui::IGUIFont* font = gui->getFont("../../media/fontcourier.bmp");
if (!font)
font = gui->getBuiltInFont();
scene::ISceneNode* text =
smgr->addBillboardTextSceneNode(font, L"Hello?", tile, core::dimension2d<f32>(50.f, 20.f));
const core::vector3df center (0.f, 0.f, 0.f);
scene::ISceneNodeAnimator* tile_animator = smgr->createFlyCircleAnimator(center, 60.f, 1 / 1000.f);
tile->addAnimator(tile_animator);
tile_animator->drop();
scene::ISceneNodeAnimator* text_animator = smgr->createFlyCircleAnimator(center, 30.f, 4 / 1000.f);
text->addAnimator(text_animator);
text_animator->drop();
scene::ICameraSceneNode* camera =
smgr->addCameraSceneNode(0, core::vector3df(0.f, 140.f, -100.f), core::vector3df(0.f, 0.f, 0.f));
while(device->run())
{
if (driver->beginScene(true, true, video::SColor(255, 40, 40, 40)))
{
smgr->drawAll();
driver->endScene();
}
}
device->drop();
return 0;
}