trigger the actuator when sensor is negative?

in python to trigger the actuator when sensor is positive we do:

    if mySensor.positive:

but how we do if we want to trigger the actuator when sensor is negative?

this don’t work:

    if mySensor.negative:

if not mySensor.positive:

that not work

Post your code. Check console for errors (Window >> Toggle System Console). It should work. Maybe try

if mySensor.positive == False

Tell us what code you put (even if it is just a snippet) and what you got in the console. You probably did something wrong…

it supose to play a motion when a cube (cubeA) is not in collision with (cubeB)

it work but only if (cubeA) enter in collision with (cubeB) one time and stop been in collision.

i want it to play the motion when the game start without the need of been in collision one time.
download and see the test, press keyboard space to enter in collision


test.blend (417 KB)

You need to activate FALSE level triggering instead of TRUE. Right now, the entire script is only run if a collision occurs. Your sensor looks like this:

For it to behave the way you describe, it should look like this:

Now, the script will ONLY run whenever it isn’t touching the other cube. If you need the script running all the time, (since now checking for .positive is redundant) you can either attach an Always sensor with TRUE activated, or set your sensor to trigger on both TRUE and FALSE pulses.

thank you very much