What's the best way to either remove or reset a Body object? I'm making
a bowling game (which has made an amazing amount of progress in just a
couple days thanks to Soya!) After the pins knock down, I want to reset
the pins and the ball. I wasn't able to find a way to reset the bodies
to their previous positions without residual forces from the previous
roll continuing to act on them.
For example, when I reset the position of the ball and do
ball.set_force((0.0,0.0,0.0)), it still retains the forward-moving (-Z)
force from the previous roll.
I tried to get around this by simply deleting the ball and pins and then
re-creating them. Unfortunately, it looks as if I haven't released the
resources, because my processor usage keeps bumping up after every new
set of objects gets created. I tried doing this (for the pins):
for pin in pins:
pin.space.remove(pin.pin_geom)
space.remove(pin.space)
scene.remove(pin)
pin.space = None
pin.pin_geom = None
pin.mass = None
pin.enabled = 0
pin = None
...but I still seem to have resources in use. Using the "del" statement
doesn't seem to help either.
Any ideas?
-Mike