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.
Seraph
Posts: 68 Joined: Wed Oct 21, 2009 5:58 pm
Post
by Seraph » Mon Dec 07, 2009 4:57 pm
i have created an array of enemies:
enemy.push_back(smgr->addAnimatedMeshSceneNode(smgr->getMesh("../../media/ninja.b3d")));
and when i kill an enemy i delete the enemy with this:
enemy.erase(i);
but why the enemy don't disappear? it is normal?
JP
Posts: 4526 Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:
Post
by JP » Mon Dec 07, 2009 5:17 pm
All you're doing is removing the enemy from the array, which is your personal list of enemies... Irrlicht still has the node in its scene graph so keeps on rendering it.
When you erase it you should also call node->remove()
B@z
Posts: 876 Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary
Post
by B@z » Mon Dec 07, 2009 5:18 pm
yeah, you have to remove the node, then remove from list
like
enemy->remove()
enemy.erase(i);