How do I send ONLY 1 pulse when keyboard sensor is True.

I have a dynamic cube

When I press W the cube will move, and keep on moving until let go of W.

I dont want that to happen.

I want the keyboard sensor to send only 1 pulse when I press W and do nothing until I let go of the W and press it again.

How can i do this?

theres probably an elegent solution to this but I use this workaround

set up a bolean property called leftkeydown for example and set it to false

together with the keyboard sensor youve already connected to the movement actuator via a controller connect up a property sensor - propery “leftkeydown” and value false

so the action will only happen if the key is pressed and the property is set to false

connect a property actuator that sets the property to true to the same controller

So - this will let you press the button once and only once so we need to reset the property when you let go of the key

create another sensor - keyboard and the key but click the inv button - this means this will trigger when the button isnt being pressed - conect this though a controller to and property actuator that sets the property back to false

Like I said not elegent and long-winded but… it works!

http://img179.imagevenue.com/loc483/th_75409_ggg_122_483lo.jpg

if the words are confusing perhaps the piccie will help :slight_smile:

Ive used this technique also if Ive got a long ipo to stop ‘stuttering’

Technically, all sensors fire only one pulse when they become active and one negative pulse when they deactivate, UNLESS the “True” fire pulsing mode is selected. Then they will continue to fire pulses.

However, blender is a bit weird, I explained it pretty thoroughly here: It’s in response to a python question, but the basics still apply. The basic idea is that the motion actuator activates when it receives a pulse but doesn’t deactivate until it receives a negative pulse. This means if you are holding down the keyboard button, it’s sent one pulse (to activate the motion actuator) but hasn’t yet sent the positive pulse. Not all of the actuators work that way though (property sensor acts as you would expect, for example).

Thank you both. This is exactly what i needed.

Take care :slight_smile: