remove IBillboardSceneNode

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
reetu.raj
Posts: 17
Joined: Wed Aug 27, 2008 5:11 pm
Location: Orlando
Contact:

remove IBillboardSceneNode

Post by reetu.raj »

Hi ,

I have been facing problem in removing the IBillboardSceneNode nodes.
I have like an array of IBillboardSceneNode* node[10].....I do bunch of stuff with those nodes in a scene in my game and then I call remove() function on those nodes but my code crashes when it comes to remove().
they are all individual nodes initilized like this

Code: Select all

bill[i] = smgr->addBillboardSceneNode(0, core::dimension2d<f32>(100,100));

None of them have any children or parent.

Can someone help me please.
I am using irrlicht 1.4.2
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

1. Initialize each index in your array with 0.
2. Check always for not-zero before accessing any member of the array (like removing)
3. Make sure you don't access over the borders. Remember that for IBillboardSceneNode* node[10] you can only access the node[0] to node[9].

Also - don't use c-arrays until you absolutely know what you do and have no other choice. They are not often needed these days. Prefer using container classes instead, like irr::array or std::vector.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

maybe it's also better to use smgr->addToDeletionQueue(node); !?!?! ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
reetu.raj
Posts: 17
Joined: Wed Aug 27, 2008 5:11 pm
Location: Orlando
Contact:

Post by reetu.raj »

thank you very much,
using irrlicht arrays worked !
it doesnt crash any more !
thank you very much again .
Post Reply