How to remove a camera

Hello, I’ve created a camera with:

camNP = base.makeCamera( buffer ) 

and, later its use, I want to remove it. How can I remove that camera? Thanks!

Beware that I’m a beginner with python and panda3d, so it may be wrong but doesn’t del camNP work?

That will just remove the reference, it won’t actually remove the object itself (unless the reference count reaches zero, but that’s not true here because there are still pointers to the camera held by Panda unless you remove it).

Since base.makeCamera() automatically creates a DisplayRegion and a Camera node, if you want to undo it you have to remove the DisplayRegion and Camera node.

Removing the DisplayRegion is done with:

dr = myCam.node().getDisplayRegion(0)

And removing the camera is as simple as:



Thank you! :slight_smile: