Jetpack flame only in the air

So far I have a script working that activated my flame particle emmiter with a keypress of space

Blockquote

Blockquote> private var pe : ParticleEmitter;

function Start() { pe = GetComponent(ParticleEmitter); }

function Update() { if (Input.GetKeyDown("space")) pe.emit = !pe.emit;

}Blockquote

Blockquote

what i want is when I land it turns it off, meaning the flame would activate upon keypress of space which also makes my character jump, and then turns off when he lands. Any ideas? Thanks

Assuming your character/player has a character controller,

function Update() {
var controller : CharacterController = GetComponent(CharacterController);
if (controller.isGrounded) {if (controller.isGrounded) {}

Makes him execute commands only when on the ground.

So a way you could do it is make a static var petoggle = true; and then in the if controller is grounded part of your script turn it to false, and then in your particle emiters script put an if(petoggle) { the press space to fire stuff} else { the not emit stuff}

Hope this works. I'm a new to unity myself though so it may be that what I say is utter nonsense. :p