Toggle switch????????

I need that when I press a Key it activate something and when I press the same key it desactivate.

For Example:
When I press Space Barr a character draws a gun and when I press Space Barr again the character keeps the gun.

It’s possible? :expressionless: I need it so much! Please help me!

The most simple toggle switch you can use is use the bool property.

Don’t really know what you mean by “keep the gun”, guessing he puts it away.
Create a bool property “draw” set initially to false. When space bar is pressed, have the property set to “!draw”. So each time you press space bar the opposite of the current state of draw is set.

That’s basic toggling.

Jason Lin

Po Natanael, aprende python, assim essas suas dúvidas básicas somem. :slight_smile:

É só criar uma variavel, ao apertar space a variavel muda pra 1, se apertar de novo space e a variavel for 1, faz outra ação e muda a variavel pra 0. E isso vai se repetindo.


GoldenTaiji, sorry, I have been expressed bad. I’m learning English and somtimes I can to say stupid things :wink:

Well, What I want to say with “keep the gun” is to put the weapon again in the coldre. I hope that I’m being clear.

I need that when I press a key a object or character ramains in the same state, moving, invisible or executing a animation for example, even when I don’t pressing this key more. And when I press this same key again the character or object reset his state being stoped, visible or stopping the animation.

Dreamkatana, valeu, mas estou com um pouco de pressa. Preciso de uma solução rápida.

Well Well Well!
More Brazilians!
Eu também sou brasileiro ae! :smiley:

Fala manow, anota meu msn ai: [email protected] Tem uma comunidade blender também: e


Here’s how I would do this.
Add a Bool property “GunOut” (or something of the sort). Set up something like this:

Property GunOut TRUE--AND---Property Assign Gunout FALSE
Keyboard SpaceBar----/   \--Action PutAway (or whatever it is)

Property GunOut FALSE--AND---Property Assign Gunout TRUE
Keyboard SpaceBar-----/   \--Action TakeOut(or whatever it is)

Does that make any sense at all?

I have the perfect solution…