O'Reilly logo

Panda3D 1.6 Game Engine by Dave Mathews

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - collecting garbage from the Cycle class

We're going to cheat a little on this one. We won't test it right away because with the current destroy method, garbage collection isn't going to happen.

  1. Open the CycleClass_00.py file.
  2. Our destroy method is missing two things that will prevent the cycles from getting cleaned up. First off, our Cycle class inherits from DirectObject and is set to accept a message when it collides with another cycle. The Panda3D message system is going to retain a reference to the class instance. To get rid of that, we need to call ignoreAll. Add this line of code to the destroy method, right before we set self.cycle to None:
    self.ignoreAll()
    
  3. The other problem is related to self.shieldCN. Remember way back ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required