I'm trying to remove a map and then load another one. This is the code:
Code: Select all
IAnimatedMesh* trackMesh;
ISceneNode* trackNode;
if (!initRun){
//load map
trackMesh = smgr->getMesh(trackFilename);
if (trackMesh)
trackNode = smgr->addOctTreeSceneNode(trackMesh->getMesh(0));
else printf("Error: Mesh could not be loaded\n.");
} else {
trackNode->remove();
trackMesh = smgr->getMesh(trackFilename);
if (trackMesh)
trackNode = smgr->addOctTreeSceneNode(trackMesh->getMesh(0));
else printf("Error: Mesh could not be loaded\n.");
}
All i want it to do is remove the currently loaded map and put in the new one but without this code it just keeps putting them inside eachother and with this code the program crashes =/
I've tried various combinations of removeMesh, remove() removeAll() and drop() but still havent come across a way that both compiles and does not crash when run. Help would be greatly appreciated.