Remove Actor

I was able to remove a model with the code loader.unloadModel.
I tried it with an actor, but got an error.
How do I remove aan actor.

Not sure of unloading but you can use following:


hide() will just hide the actor for the camera, so that might not be good enough in most cases.

What about actor.delete() ?
Whenever you are looking for a function, the API Reference is always a good place to start.

Thanks pro-rsoft, for the link. I will try delete().
Thanks Smriti Sharma for replying. Using hide() will not accomplish what I want. I notice that my frame rate increases as long as I get rid of, or stop rendering a model, which is what I want.

Couple other things to try are calling stash() and unstash().

You can also try reparenting to hidden.

These both tend to work better than hide()


stashing or reparenting to a hidden node does NOT remove the node from the scenegraph, and will therefore NOT clear any memory.
Calling delete() or cleanup() is the way on an actor, or removeNode() on a model.


Stash and reparenting does not remove the node but they do stop those nodes and their children from being processed by the scene graph.

Most of the time thats enough to get a significant performance boost from unwanted complicated models/actors and one doesn’t have to worry about setting up the model again later.

I’ve found stash works pretty well for most cases, but your mileage may vary. =)