Hi
I am making a maze game in 3D which uses a bunch of CubeSceneNodes. Now I want to be able to delete a specific cube scene node in certain circumstances.
I tried using drop, but then the system crashes. Am I missing something obvious ?
Cheers
Dropping nodes
Re: Dropping nodes
Works the same as all reference counting in Irrlicht: http://irrlicht.sourceforge.net/docu/cl ... unted.html
If you didn't create it with a function starting with the word "create" or created the object with new or did grab() it at some point you should not drop objects.
What you most likely want to do is remove it from the scenemanager, which you do by calling remove() on your node.
If you didn't create it with a function starting with the word "create" or created the object with new or did grab() it at some point you should not drop objects.
What you most likely want to do is remove it from the scenemanager, which you do by calling remove() on your node.
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
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
-
- Posts: 45
- Joined: Mon Apr 23, 2012 9:31 am
Re: Dropping nodes
Thanks for the reply
I tried this
to try and get rid of the crash that I get when I call this :
This was just a test to see if it gets removed, but the program still crashes ?
What else am I missing ?
Cheers
I tried this
Code: Select all
if (HumanNode)
HumanNode->setPosition(core::vector3df(500+(500*Human.iX),200+(500*Human.iY),500));
Code: Select all
else if (receiver.MyEvent.KeyInput.Key==KEY_KEY_R)
{
HumanNode->remove();
}
What else am I missing ?
Cheers
Re: Dropping nodes
Safer way:
It's better to run the program with a debugger to see where it crashed.
Regards
smso
Code: Select all
if (HumanNode)
{
HumanNode->remove();
HumanNode = 0;
}
Regards
smso
Re: Dropping nodes
Also you may try deleting using
maybe will help you.
Code: Select all
void irr::scene::ISceneManager::addToDeletionQueue(ISceneNode* node)