Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by RAWTalent · Feb 21, 2011 at 09:19 PM · offjetpackflame

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

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image rohan bhangui · Oct 03, 2011 at 11:19 PM 0
Share

i was wondering if youcould right the code like the guy below so that i could understand it better

avatar image rohan bhangui · Oct 03, 2011 at 11:24 PM 0
Share

also how do you make it so that when you press and hold down a key (exg. hold down space) you get the particle effect to turn on but it turns off as soon as you let go?

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Joshua · Feb 21, 2011 at 09:27 PM

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

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Joshua · Feb 21, 2011 at 09:28 PM 0
Share

the if (controller.grounded) part and the petoggle stuff must be put in the script that controls your character of course. :)

avatar image RAWTalent · Feb 21, 2011 at 09:32 PM 0
Share

Hmnn I get this error

$$anonymous$$ identifier: 'controller'.

avatar image RAWTalent · Feb 21, 2011 at 09:44 PM 0
Share

Still not working :S

avatar image Joshua · Feb 21, 2011 at 09:51 PM 0
Share

$$anonymous$$y fault I edited the answer.

avatar image Joshua · Feb 21, 2011 at 09:53 PM 0
Share

I forgot to define controller -.- sorry for wasting your time.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

Having trouble turning off gravity through script 1 Answer

Turn on/off Script 3 Answers

Turn off another script with Javascript 1 Answer

JetPackParticleController not working in the 3D Platformet Tutorial 0 Answers

Light script flashes on and off 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges