I have objects that fall down on a cube. I have a python script that gets triggered by the collision logic brick so that after certain actions (counting etc.) the object gets destroyed by calling the endObject() method.
The problem is that the “endObject()” method triggers another collision event and thus the script runs twice causing a lot of trouble.
I tried to play around with all kinds of settings on the collision logic brick, but I cannot get rid of the second trigger.
The second trigger might not be caused by the endObject() call. I think blender does that anyway…don’t know why…but it does. Could you post a blend?
You’re probably getting the negative pulse since the collision has ended. Python controllers are activated one positive and negative pulses. Just filter for positive pulses in your script:
if sensor.positive:
foo()