Page 1 of 1

How do you drop a node?

Posted: Fri Oct 07, 2005 3:33 pm
by GameCreator
Sounds like a simple question and I'm sure the solution is simple but I couldn't find an answer on these forums.

My problem is that I want to load a level, play in it, drop it, then load another but when I looked in the Irrlicht help for a create function for nodes, I couldn't find one. I understand that drop() only works on things that are created. So if no create function exists for nodes, how do you create one that can be dropped?

My search only turned up one useful thread, which I didn't quite understand, somehow involving the grab() function. Does that turn non-drop()-able objects into drop()-able ones?

So, in short, if I have:
IAnimatedMesh* mesh = smgr->getMesh("data\\level01.3ds");
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );

How do I now drop() that?

Thanks!!

Posted: Fri Oct 07, 2005 4:07 pm
by Elise
node->remove();

or

SceneManager->addToDeletionQueue(node);

First one can cause the app to crash under certain conditions so you might want to use the other one.

Posted: Sat Oct 08, 2005 3:58 am
by Grey Lantern
I do a scenemanager->clearall then reload for different areas. Not sure this is optimal but it seems to clean up the resources!

Posted: Sat Oct 08, 2005 6:12 pm
by GameCreator
Awesome!! Thanks Elise and Grey Lantern!

(Also, just a heads-up that it's just clear(), not clearall() that clears everything, at least in my version (0.10.0))