Hi I'm having trouble of deleting object, here is my code;
Quote:
###
class Parent:
def __init__(self):
print "init from parent"
def duit(self,duit):
self.salary = self.salary + duit
return self.salary
def remove(self):
self.obj.remove()
class Child(Parent):
def __init__(self):
Parent.__init__(self)
print "init from child"
self.obj = viz.add('duck.cfg')
self.salary = 100
class World:
def __init__(self):
self.c = Child()
self.final = self.c.duit(50000)
print self.final
w=World()
viz.go()
###
|
When I do 'w.c.remove()', the 3d model is gone, but w.c still exists.
If I do 'del w.c', it will delete w.c, then I can no longer delete the duck.
Does that mean that in my World class, I need to create method to delete the object first and the reference/instance later? e.g when the child (duck) collide with ball and delete child within the World class, I need to do.... self.c.remove() and del self.c later?
I thought that <node3d>.remove would delete object from the scene including associated instances ? Is there a way to delete instance along with the object as well?
Thank you for your time. (all the tabs in my code seem to be missing when I copy-paste here)
Kind Regards,
Iwan