• 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 MeatbagWammo · Nov 05, 2010 at 05:42 PM · javascriptparticlesfire

How to make fire spread?

I am making an fps with some friends, and the first scene is a forest. I would like to have the ability to set the forest on fire, similar to far-cry 2. More specifically, I want a single fire particle system to spread out, maybe by spawning clones next to it, then eventually die.

I have no idea where to start with this. I have the particle system set up, but I just need the script. If someone can just give me something to start with and point me in the right direction, I can go from there.

Thanks, MeatbagWammo

Comment
Add comment · Show 1
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 Aerovistae · Dec 01, 2012 at 08:02 AM 0
Share

....$$anonymous$$eatbagWammo?

3 Replies

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

Answer by VS48 · Nov 05, 2010 at 06:47 PM

1) Put a sphere mesh into your scene

2) Remove all components except the MeshFilter from it

3) Add a mesh particle emitter component to the sphere (See instructions here, also add an animator and particle renderer)

4) Your sphere should now be emitting particles. Adjust the particles so they look like fire or however you want.

5) Create a new script and attach it to your sphere. The script to scale your fire could be as simple as:

using UnityEngine; using System.Collections;

public class FireSphere : MonoBehaviour { void Update() { // Grow the fire in the X & Y directions transform.localScale += new Vector3(Time.deltaTime, 0f, Time.deltaTime); }

}

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

Answer by denewbie · Nov 06, 2010 at 04:53 PM

Use the Particle EMitter. It was created for such effects:

http://unity3d.com/support/documentation/Components/comp-ParticlesGroup.html

To make the fire spread: Change the elipse size you want. To make "Clones" just identify the number of particles you want it to emit. To make it disappear, set the time you want the particles to last. To make the fire bigger, set the size you want it to increase to.

Finally, attach a script to destroy the emmitter object once you re done with your effects.

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 VS48 · Nov 08, 2010 at 02:42 PM 0
Share

I'm not sure that the ellipsoid scaling can be done through script

avatar image codingking · Mar 05, 2012 at 11:19 PM 0
Share

This does not work. The ellipsoid parameter cannot be changed via scripting.

avatar image
0

Answer by codingking · Mar 06, 2012 at 03:03 AM

I added the sphere mesh and mesh particle emitter and it worked very well for me. Remember to select "interpolate triangles" in the emitter to avoid only emitting particles from the vertices. Here's the source code I used (Javascript):

 var growthInterval : float // seconds
 var growthRate : float;     // meters/second
 var particleDensity : int;   // # particles/meter
 
 function Start() {        
 while(transform.localScale.x < 10) {
     yield WaitForSeconds (growthInterval);
     if (particleEmitter.emit) {
         transform.localScale += new Vector3(growthRate * growthInterval, 
                                       0f, 
                                       growthRate * growthInterval); 
     
         particleEmitter.minEmission = (growthRate * growthInterval + transform.localScale.x) *
                                        particleDensity;

         particleEmitter.maxEmission = particleEmitter.minEmission;
     }
 }

}

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 kakuridoji · May 18, 2013 at 04:40 PM 0
Share

didn't work for me :(

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Can someone help me fix my Javascript for Flickering Light? 6 Answers

Setting Scroll View Width GUILayout 1 Answer

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

Rain Particle random start 0 Answers

how to have bullets produce particles? 2 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