delete scene node

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
pandoragami
Posts: 226
Joined: Wed Jan 26, 2011 5:37 pm
Contact:

delete scene node

Post by pandoragami »

How do I delete a scene node such as

Code: Select all

 cube = smgr->addCubeSceneNode(5, 0, -1,position,rotation,scale);
    
I tried using

Code: Select all

delete cube
but that didn't work.
BrianATSI
Posts: 23
Joined: Thu Jan 10, 2008 9:00 pm

Post by BrianATSI »

cube->remove();

... should do the trick most of the time
pandoragami
Posts: 226
Joined: Wed Jan 26, 2011 5:37 pm
Contact:

Post by pandoragami »

.. should do the trick most of the time
Well unfortunately this is one of those rare times it didn't work. Any other methods?
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

If you're doing this from inside a custom scene node or animator then you can use smgr->addToDeletionQueue instead.

You'll have to define exactly what you mean by "didn't work" though. If you mean it crashed your program like "delete cube" did, then you're doing something wrong with memory management. If you mean it wasn't removed from the scene graph then you're creating more than one cube but only removing one of them.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
pandoragami
Posts: 226
Joined: Wed Jan 26, 2011 5:37 pm
Contact:

Post by pandoragami »


You'll have to define exactly what you mean by "didn't work" though.
It works now thanks.
Post Reply