• 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 Recluse · Sep 14, 2015 at 01:14 PM · particlesystemparticle systemshuriken

Set Particle lifetime by distance, not time?

It seems like particle lifetime is time dependent. Is there a way to kill a particle after it has traveled X meters? I want to use particles to represent information travelling between nodes. The nodes could be any distance apart and I want the particle to die when it reaches its destination, however I don't want to use collisions for this id possible.

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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Recluse · Sep 14, 2015 at 01:31 PM

Thanks, I'd need multiple objects though if I needed 25 nodes to be simultaneously transmitting particles.

I have a single particle system which handles unlimited nodes emitting particles, and it's fine apart from one thing - the particles sometimes overshoot the receiver nodes - because their lifespan is determined by time, not by distance.

I know the positions, etc of everything. But I'm not sure how to tell a particle to die after 25 meters.

I could use OnParticleCollision() but it would be far simpler if I could just tell each particle to die after X meters. I was thinking if I know how fast they move, I could work out the time it will take a particle to travel X meters and set the lifetime accordingly. But I can't find in the docs what particle speed is (i.e. if it's measured in meters per second)...

This seems to work:

 Emitter.startLifetime = Vector3.Distance(Emitter.transform.position,target.position)/Emitter.startSpeed;





Comment
Add comment · Show 1 · 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 Navarrox · Feb 24, 2018 at 07:42 AM 0
Share

I know this is a really old QA but i just wanted to thank you! This simple equation saved me a ton lol.

avatar image
0

Answer by garamanx · Nov 18, 2020 at 04:23 PM

@Recluse thanks! still saving my and other lives in the 2020's :D

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

29 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 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

Multiple trails behind one particle? 1 Answer

Particle system ends with shuriken graphic 1 Answer

Particle System is not respecting sorting layer 0 Answers

How to make particles react to movement of particle system 4 Answers

Shuriken collision with terrain? 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges