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
0
Question by animalphase · Oct 09, 2013 at 08:03 PM · particlestimeparticletimescalemesh particle emitter

Smoothly start and stop particles

Basic issue:

I have a bunch of particles frozen in space by setting particleEmitter = false;

When re-enabling the particleEmitter ("un-pausing the particles"), I want them to gradually accelerate to their original speed and continue on course.

Current setup:

I am using a legacy Mesh Particle Emitter to emit particles inward from a sphere mesh.

The particles look like stars, and the effect I am achieving:

  1. Emit particles for several seconds to fill the screen with particles that look like stars.

  2. Set particleEmitter.enabled = false; This freezes the star particles in space, and it looks like a typical photograph of a starry sky.

  3. Now, I want to simulate a camera "zoom out" through the stars. To achieve this, I set Time.timeScale = 0f; particleEmitter.enable = true;

  4. In the Update() function, Time.timeScale += .001f; to gradually raise back to Time.timeScale = 1.0f. This effectively makes it look like the particles gradually accelerate back to their original velocity.

This setup works pretty well, EXCEPT for a problem occurs in Step 3: Its seems like after re-enabling the particleEmitter, even though Time.timeScale is set to zero, the particles retain their original speed for a single frame, causing a notable jump in the particle animation.

tl;dr

Even if Time.timeScale remains set to zero, re-enabling the particleEmitter on a legacy Mesh Particle Emitter allows particles to retain original velocity or movement amount for a single frame, which causes a jump in motion.

Is there some workaround, like setting each particle's velocity to 0 and then increasing it again?

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

1 Reply

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

Answer by MarkD · Oct 09, 2013 at 08:26 PM

I think you need to create a for loop accessing all particles and their speed value. Because if you freeze time, you don't remove their current velocity value, it will be the same and can only be changed in the next frame.

So what's happening is when you speed up your time again, the particle system will already have calculated the current velocity and thus the distance and location for the next frame coming. That is what is causing your stutter.

Comment
Add comment · Show 4 · 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 animalphase · Oct 09, 2013 at 09:35 PM 0
Share

Thanks, this works perfectly! I'm fiddling around with a few different implementations.

I figured that the solution would be something like this, but I wasn't sure how to interact with individual particles in a practical way. Thanks for the advice.

avatar image animalphase · Oct 10, 2013 at 12:53 AM 0
Share

Hm, I'm actually having inconsistent results when reassigning a velocity to the previously-frozen particles. It seems to work at random times, and at other times causes the same jump.

I will experiment by perfor$$anonymous$$g some actions in FixedUpdate or LateUpdate, but in the meantime, it's actually okay to just keep the old particles with a velocity of (0,0,0), and to let them just fade out in place.

avatar image MarkD · Oct 10, 2013 at 07:29 PM 1
Share

Well, since you need to do the calculations before the next frame LastUpdate could maybe work, because this will cause to do the calculations after the frame is drawn and apply them to the next, so if you stop time at that current stopped frame your calculation will be done and ready for the next frame, so basically you have override the particle systems calculation. But as always with particle systems it is a lot of fiddling around as you said.

avatar image animalphase · Oct 18, 2013 at 11:35 PM 0
Share

Thanks for the extra insight, $$anonymous$$arkD. I am still fiddling as I work towards the next version :)

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

16 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Particle Emitter Breaks in emission. Help? 1 Answer

Orienting particles based on velocity 1 Answer

Accelerating Time Dramatically 1 Answer

Single Step (pause, resume), or externally clock game loop 0 Answers

Time.timeScale not working with Havok Physics 0 Answers


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