Making only one object emit from a true pulse sensor?

I want to make it so I can add an object via a true pulse sensor in python, but it only gets added once regardless of the true pulse. For instance, the object (a crate) hits a surface, creates a splash, but doesn’t create any more than just one. And how can I make it so it works with multiple splash objects in a list? I’ve tried a globalDict counter, but it doesnt work. I’ve tried a list and using > to make it so there is a check for more than one splash to stop adding. Nothing. I’ve tried everything Python related. I am at my wits end.

The way this is meant to work is as follows:

  1. An object (can be multiples at a similar distance) strikes a plane.
  2. The plane is scripted to add multiple splash objects of different sizes.
  3. Even if the Collision Sensor is set to true pulse, the splashes will not be added more than once when the object is passing through it. This stops multiple splashes from appearing below the surface.
  4. The script checks if there are too many splashes being added (the sensor triggers twice and more times than once), and disables adding any more splashes, but only once a small tiny delay has passed.

But no matter how I do it, it either makes errors or just ends up with the same result as before - splashing twice with multiple instances of the same object passing through the plane, which is not a good look for water. I want to make it so once a splash has occurred, a check is run on the object hitting the plane, if it is passing through and creating a second positive pulse, the check then disables a second splash from occurring once the object is at its middle in the plane or already in the plane.

well, joke aside, it’s a good example on the reason why that “pulse” frenzy in any upbge tutorials should be taken cautiously . People end up having stuff that seems to work whilst they don’t really understanding what’s happening under the hood.

Setting a sensor with “True pulse” doesn’t provides True pulse no matter what . It says that if the sensor is True, it will keep provide True pulses. So either the collision sensors detects only the hitting moment as a collision (=True) and then consider there’s no more collision possible after (=False) - either you have set a “tap” option on the sensor that implies that the first “True” pulse of your sensors has to be followed by a negative one just after.

To know you have to print() the “.status” or the “.positive” of your sensor to have a clue on what’s happening really

I’m no sure understanding well what you are trying to achieve really but , related to your collision sensor, one can imagine to combine it will some Property sensor and actuator

So here below, after a the collision moment, your script will exe 50 times + 1 time when it will just turn to be no longer True

If i set the collision sensor also on pulse positive, the property “count” never gets down. So it proves that the collision = being in contact and not so about a collide moment.