PDA

View Full Version : How do I run a destructor before the end of the program?


EnvisMJ
12-10-2009, 04:40 PM
I am writing a program that is basically just a bunch of critters running around.
I can create them fine...but how do I run the destructor on them when they die without waiting till the end of the program?

Jeff
12-10-2009, 08:19 PM
You can use the <node3D>.remove() command to permanently remove the object from the scene.

EnvisMJ
12-11-2009, 06:34 AM
2 questions about that,
Does the .remove() actually run the destructor also? Does it free up it's resources, etc?

Also, it throws a '...does not have .remove() function' error when I try to run it on my own class object. Do I need to do something special to include .remove()?

Jeff
12-14-2009, 05:17 PM
Yes, it will free up resources used.

This method will work on Vizard's node3D objects.