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
0
Question by nickostan · Sep 07, 2017 at 12:31 AM · meshvector3particlesmeshes

Particle systems: Defining the vertices of an EDGE-type emitter

Hey,

I was wondering if its possible to emit particles along an edge that has its vertices defined programattically.

For example, on click, instantiate a particle emitter with shape-type EDGE that has vertices at (0,0,0) and (1,1,2). In another case I want it to have vertices at (1,1.5,3), and (2,5,2)... etc. These are just arbitrary numbers. I want to be able to define the 'mesh' with each click.

alt text

I tried making a mesh with just two vertices but I got lost half way because I don't know how to save a mesh prefab to be dragged into the 'mesh' box in the editor.

unity-help.png (5.1 kB)
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 FortisVenaliter · Sep 07, 2017 at 08:05 PM

Personally, I would do this programmatically. You can call the Particle System's Emit() function with a position specified, so... handle the emission yourself. Calculate a random point on the line and emit a particle there each frame, or more if you want. That way you don't need to add a mesh or anything complicated.

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 nickostan · Sep 07, 2017 at 08:26 PM 0
Share

I assume you're talking about modifying this?:

https://docs.unity3d.com/ScriptReference/ParticleSystem.EmitParams-position.html

In this case, if the line happened to be long and I wanted a particle emitted every inch or so, I'd have to instantiate 50 gameobject each emitting one particle... this doesn't seem feasible. Surely there must be a way to emit particle along a line? For example.. define two points that constitute the mesh and emit along it. No?

avatar image FortisVenaliter nickostan · Sep 07, 2017 at 08:29 PM 0
Share

Not at all. You only need to create one. You just need to modify the position on it in between emitting each particle, and you can keep passing in the same instance.

Plus, EmitParams is a struct, not a GameObject. Very different in how memory is handled.

avatar image nickostan FortisVenaliter · Sep 08, 2017 at 01:37 PM 0
Share

So in my case, I instantiate a prefab particle emitter gameobject and move the transform of that gameobject? I want all of the particles to appear simultaneously along that line, not one by one. Seems like doing it this way, it would emit a single particle each frame and I'd have to specify the new position of it in every Update() call.

Forgive me if I'm wrong again but I think you need to include more detail in what you're saying. Basically what I'm making is a lazer. The player shoots from the tip of the gun to a point on the map. I want, after the lazer has been shot (which is currently handled with a lineRenderer), particles to spawn and decay as though the heat of the lazer warped the path that was shot. I don't want a single particle emitted every frame along the path.

Show more comments
avatar image
0

Answer by richardkettlewell · Sep 08, 2017 at 09:34 PM

We've just added support for particle systems to Emit from meshes that use the Lines primitive type, in 2017.3.

Just create a mesh, similar to here: https://docs.unity3d.com/ScriptReference/Mesh.html

And then assign it to the shape module of your particle system.

(I'm posting this mainly as a hint for future readers, as 2017.3 is not yet out, as I write this!)

Comment
Add comment · Show 2 · 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 nickostan · Sep 09, 2017 at 07:42 PM 0
Share

When does this come out?

avatar image richardkettlewell ♦♦ · Sep 09, 2017 at 09:28 PM 0
Share

It's due later this year

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

91 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 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 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 avatar image avatar image avatar image avatar image

Related Questions

moving hole 3 Answers

Creating 3D shapes by given coordinates 0 Answers

Is there a way to add mesh, being modified during play mode, to particle component to emit particles from it? 2 Answers

May I substitue the default particles with my particular mesh? 2 Answers

Finding the height of a mesh 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