• 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
5
Question by qJake · Mar 31, 2010 at 11:28 PM · particlesemitter

Script access to "Ellipsoid" property on Emitter

Quick question: I want to animate the "Ellipsoid" property of an Ellipsoid Particle Animator (the property that sets the size of the invisible "ellipse" where the particles will spawn inside, randomly), but it doesn't seem to be in the "ParticleEmitter" class. Is t$$anonymous$$s a property that's scriptable?

Edit: I've tried using a cylindrical mesh, but the Mesh Emitter just takes a mesh, and it can't be scaled using code at runtime. Anyone else have any ideas of how I could make my emitter emit range "grow" over time? I can't use Force because it messes with some of my other properties and makes the effect of the emitter look weird.

Comment
Add comment · Show 4
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 Shinugami · Oct 30, 2012 at 01:33 PM 0
Share

Agreed, It should be accessible via script. I have a dust trail effect which I wanted to reuse for different shaped boulders and just adjust the radius of the particle emitter's ellipsoid but now it seems i will need to create a dust trail prefab for every size boulder and this rules out changing sizes of boulders by code because then the effects wouldn't work.

avatar image AlucardJay · Nov 08, 2012 at 04:47 AM 0
Share

Hey there, I agree. I found this page while searching for unity change particle emitter ellipse , what a bummer! Now I have to start again, do some tests with mesh emitter and think about a scalable mesh that adds verts depending on size .... bummer =[

avatar image Shinugami · Nov 08, 2012 at 07:46 AM 0
Share

Thanks. First time I commented in this webpage so I'm new to the process.

avatar image AlucardJay · Nov 08, 2012 at 01:06 PM 0
Share

No worries, most new users don't know about the comment system and that little button !


I have been playing around with this tonight, and have made a basic solution to create a mesh for a mesh emitter that is currently just a line, you give it a length and the space between each vert along that line, then the mesh emitter does its thing on each vert. It is basic but works. The next task, and much bigger, will be to create a sphere mesh to emit from, and then expose variables for the number of verts, and sphere XYZ dimensions hopefully replicating the effects of the ellipse settings in the ellipsoid emitter. Anyway, here's the code for the line emitter :

 #pragma strict
 import System.Collections.Generic;
 
 public var setLength : float = 5.0;
 public var spacing : float = 0.25;
 public var emitPerUnit : float = 10.0;
 private var theEmitter : ParticleEmitter;
 private var mesh : Mesh;
 private var vertsList : List.< Vector3 > = new List.< Vector3 >();
 
 function Start() 
 {
     theEmitter = GetComponent( ParticleEmitter );
     StartMesh();    
     //
     SetVerts( setLength );
     BuildMesh();
     SetEmitter();
 }
 
 function Update() {
     if ( Input.GetMouseButtonDown(0) ) {
         SetVerts( setLength );
         BuildMesh();
         SetEmitter();
     }
 }
 
 function SetEmitter() {
     theEmitter.maxEmission = theEmitter.minEmission = parseInt( setLength * emitPerUnit );
 }
 
 function SetVerts( theLength : float ) 
 {
     vertsList.Clear();    
     var count : int = parseInt( theLength / spacing );    
     for ( var i:int = 0; i < count; i ++ ) {
         vertsList.Add( Vector3( 0.0, 0.0, (i * spacing) ) );
     }
 }
 
 function StartMesh() {
     if ( !mesh ) {
         mesh = new Mesh();
         GetComponent(MeshFilter).mesh = mesh;
         mesh.name = "ParticleMesh";
     }
 }
 
 function BuildMesh() {
     mesh.Clear();
     mesh.vertices = vertsList.ToArray();
     var tris : int[] = new int[ vertsList.Count * 3 ];    
     for ( var v:int = 0; v < vertsList.Count; v ++ ) {
         tris[v] = Mathf.FloorToInt( v / 3.0 );
     }
     mesh.triangles = tris;
 }

3 Replies

· Add your reply
  • Sort: 
avatar image
4

Answer by dhendrix · Apr 01, 2010 at 07:56 PM

Since you can't access the ellipse, you should be able to just use a mesh particle emitter, then scale the mesh. Not quite the same t$$anonymous$$ng, but a compromise that might work.

Comment
Add comment · Show 7 · 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 qJake · Apr 01, 2010 at 10:04 PM 0
Share

Oh, and then I could just turn the renderer off on the mesh to make it invisible, yeah... that might work. Thank you for the idea!

avatar image dhendrix · Apr 01, 2010 at 10:06 PM 0
Share

Cool, hope it works out.

avatar image qJake · Apr 04, 2010 at 07:14 PM 0
Share

Unfortunately, this didn't work. You can't scale the mesh within the code, either. Anyone else have any ideas?

avatar image Eric5h5 · Apr 04, 2010 at 08:32 PM 0
Share

You can scale the mesh with code; change transform.localScale.

avatar image Waz · May 05, 2011 at 02:19 AM 1
Share

Scaling the mesh won't work, but moving the vertices themselves might.

Show more comments
avatar image
3

Answer by Tasarran · Jan 10, 2012 at 05:27 AM

It may not be scriptable, but it is exposed in the Animator.

Just assign a new Animation to the emitter, and you have access to everyt$$anonymous$$ng.

I know t$$anonymous$$s works, because I was just animating the Ellipsoid on my project today.

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 yoyo · Apr 12, 2012 at 05:47 AM 0
Share

Just trying this out now with the shape parameters of a Shuriken particle system. I can use an animation to animate the "Shape Module.box X/Y/Z" properties. This works in preview mode when I run the animation in the Editor. But: (1) the entire particle system scales, including previously emitted particles, and (2) when I press play I get three particles emitted and the whole thing dries up.

avatar image
2

Answer by Eric5h5 · Apr 01, 2010 at 12:27 AM

No, it's not scriptable.

Comment
Add comment · Show 3 · 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 qJake · Apr 01, 2010 at 04:46 AM 0
Share

... That's it? Just "no"?

I need to animate this property somehow, do you have any suggestions as to how I could do that?

avatar image Eric5h5 · Apr 01, 2010 at 05:02 AM 0
Share

Really no, it is really not scriptable. ;) I'm not sure what else I can say...not everything is exposed to scripting. You can go here and vote for it: http://feedback.unity3d.com/forums/15792-unity/suggestions/163600-scripting-expose-more-classes-properties-to-scrip?ref=title

avatar image Kevin Laity · May 21, 2010 at 05:55 PM 0
Share

What an oversight! I don't understand why any variable I can see in the Editor wouldn't be scriptable! At the very least there should be a catch-all function like Component.setVariable(string, object)

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Script code for 'and' isn't working 1 Answer

Is there a way to emit lit particles? 0 Answers

How would i write a script to add a Particle system to an exhaustust 1 Answer

Death with particle effect.Still need Help! 5 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