Need help cleaning up

I’ve set up my game to cleanup everything and return to the main menu, when the user exits the game. When the user presses play, he enters
the game “with a clean slate”.
My problem is that everything has been cleaned up, except the collision thing (the red thing that is seen when you uncomment
self.cTrav.showCollisions(render)). The used one is left behind, and a
new one create each time the game starts.
I am not sure, but I believe it has something to do with

self.playerZcol.traverse(render) in this code:

Code:
# Update Player Z (Keep player on Terrain)
def updatePlayerZ(self, time):
if self.page == 1:
startpos = self.Mod1.getPos()
self.playerZcol.traverse(render)

        if self.playerZcolQueue.getNumEntries>0: 
            self.playerZcolQueue.sortEntries() 
            point = self.playerZcolQueue.getEntry 

(0).getSurfacePoint(self.env)
self.Mod1.setZ(point.getZ())
else:
self.Mod1.setPos(startpos)
# End updatePlayerZ

Is there a code I can use to clean this up when I end the game?
Also, is there a code in Panda, that calls “restart game”?
Thanks

hmm this sounds hard. In my game i have an external program launch panda3d. If panda3d exits with an error code indicating it wants a restart (error code 9) the launcher restarts it again. I needed this so that i can patch panda3d mostly, but you can use this technique for what you are doing. If you are just changing levels, what i do in my game is unload the level, unattached all the collisions things and attach them again. Works great. Basically undo what i did before.

In order to clean up collisions or anything else, you have to undo everything you did. This is possible.

In particular, make sure you call:

cTrav.removeCollider()

for each time you called:

cTrav.addCollider()

David

This is just double thread. It’s already solved in Scripting section.