how do i delete a model in my game?

i was wondering how to destroy a loader.loadModel() object. There are more than 1 of these so I can’t unload the model and I’d rather not have a ton of the same object loaded so I can unload them one by one.


It is possible using the np.removeNode() method:

np=loader.loadModel("jack") #load a model
#... do something
np.removeNode() #unload the model

I’m not sure if this is what you mean, but since loader.loadModel() returns a NodePath:

np = loader.loadModel( ... )
np.removeNode( )

This will (1) disconnect the referenced node from the scene graph, and (2) mark the node path for destruction.

This does not unload the model geometry from the memory cache. This can be done AFAIK with

loader.unloadModel( path )