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 Kacer · Feb 14, 2011 at 09:46 AM · particles

Scripting particle systems.

So, i have been looking into this for some hours now, but i really cant find a solution, or tips on how to do this.

There are two issues, one being: Is it possible to make a script for a particle emitter, ie, controlling the force on an axis with a random number script. And the other being: Is it possible to use a mesh instead of a texture on the particle emitters.

I know it is possible to script the particle emitters, what i dont know though, is how to do it, so if anyone has some reference to some tutorial or whatever, it would be very welcome.

I'm kinda new to scripting and unity, so if there's some parts that doesnt make sense in this text, that is probably the reason.

-Seth

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
2
Best Answer

Answer by Eric5h5 · Feb 14, 2011 at 09:56 AM

The docs describe how to script particles: http://unity3d.com/support/documentation/ScriptReference/ParticleEmitter-particles.html. You can't use meshes for emitted particles.

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
1

Answer by psychentist · Jul 01, 2011 at 07:57 AM

The closest thing you can do to emitting meshes is a mesh spawning object. Simply create an empty object and add this script, then drag the desired prefab to the variable slot in the inspector. Set the interval to the desired value and play. (Smaller interval value = faster emission rate.)

 var prefab : Transform;
 private var randomNumX : float;
 private var randomNumY : float;
 private var randomNumZ : float;
 var interval : float;
 private var nextEmit : float;
 
     function Start(){
     nextEmit = interval;    
 }
     
     function FixedUpdate(){
 
       randomNumX = Random.Range(-400,400);
       randomNumY = Random.Range(-400,400);
       randomNumZ = Random.Range(-400,400);
 
       if (Time.timeSinceLevelLoad > nextEmit){
            
      nextEmit += interval;
       MakeObject();
       }
 }
     
     function MakeObject(){
     
     madeOb = Instantiate(prefab, transform.position, transform.rotation);
 
        if(madeOb.rigidbody){
      madeOb.rigidbody.AddForce(Vector3(randomNumX,randomNumY,randomNumZ));
     }
 }
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

1 Person is following this question.

avatar image

Related Questions

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

How do I use emissionRate in scripting? 1 Answer

Timetrail script creating 2 trails and not destroying the second 0 Answers

how to have bullets produce particles? 2 Answers

help in animation/code 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