off and on switch

How do I make a switch turn off if it is touching something, and on if it is not?

Me and a few other people have done it. I dont directly remember the rig though

Do you know any of the games?

@grazer