Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
-2
Question by Hasjbrownie · Jun 21, 2011 at 09:47 AM · collisionparticleemit

Emit Particle when the parent gets collision

I'm making an evasion game where you have to evade objects with a ball in a random generated world. When that ball hits an object, that object has to emit a particle. But when the ball hits the object , that object doesnt emit a thing. And when the prefab of that object spawns again the particle is constantly emitting.

this is the code i used to emit the particle the private var goan gets a boolean from the object (true = collision on object)

 private var hitParticles : ParticleEmitter;

 private var  goan = FlasherScript.ParticleEmit;

 function Start () { 
     hitParticles = GetComponentInChildren(ParticleEmitter);   
 
     if (hitParticles) {
         hitParticles.emit = false;
     }
 }
 
 function Update () {    
     if(goan == true) {
         Emitten();
     }
 }
 
 function Emitten() {
     hitParticles.emit = true;
     yield WaitForSeconds(3);        
     hitParticles.emit = false;
 }
Comment
Add comment · Show 1
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 GTaveira · Jun 21, 2011 at 12:02 PM 0
Share

What is "FlasherScript.ParticleEmit" ?

Also, you said "When that ball hits an object, that object has to emit a particle. But when the ball hits the object , that object doesnt emit a thing." ... I believe you meant something else there, so try clarifying this sentence. It will help us better understand what you are trying to achieve here.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Waz · Jun 21, 2011 at 11:56 AM

You are only initializing goan (i.e. once). Try something more like this:

 private var hitParticles : ParticleEmitter;
 
 private var goan = false;
 
 function Start () { 
     hitParticles = GetComponentInChildren(ParticleEmitter);   
 
     if (hitParticles) {
         hitParticles.emit = false;
     }
 }
 
 function Update () {
     if (FlasherScript.ParticleEmit && !goan) {
         goan = true;
         Emitten();
     }
 }
 
 function Emitten() {
     hitParticles.emit = true;
     yield WaitForSeconds(3);        
     hitParticles.emit = false;
     goan = false;
 }

You could simplify it a lot further too (the goan variable isn't really needed at all), but the above hopefully highlights the mistake.

Comment
Add comment · 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
0

Answer by Hasjbrownie · Jun 21, 2011 at 12:12 PM

Thx , now the partical emits when it collides , strange thing is they don't stop emitting.

But you were a great help, Big Thanks! ;)

Comment
Add comment · 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

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Particle colision using shruiken 1 Answer

Using a particle System in an if statement 1 Answer

What kind of datatype is a CollisionEvent? 2 Answers

How to draw a line to change the direction of water fall simulated by particle systems 0 Answers

How to create particle system on a collision? 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