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 ptoinson · Dec 01, 2010 at 03:42 AM · particlesgun

Particles Energy vs Emissions

Hello, I'm a bit new to unity so I apologize in advance if this is basic. I'm creating a particle system to simulate the flash from a machine gun. I simply want to flash one particle very briefly at a regular rate. Additionally I want to control the rate of flash to match the rate of my machine gun. Pretty simple and I have it all setup. What I'm noticing, however, is that when I crank the min and max energy level fairly low (0.01) I have to crank my Min and Max emission level way up to any speed out of it. I was expecting the emission level to not depend on the energy level unless I surpass some max number of particles. But since my energy is so low, I really only want one particle at a time, which I'm getting. The question is more around the particle system as I understand several ways of doing the actual muzzle flash.

Any help would be greatly appreciated.

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

Answer by Tuti · Dec 01, 2010 at 04:30 AM

I wouldn't use a particle system to show a muzzle flash. Instead I'd use a mesh renderer which would have a shape, texture and properly shader applied like particles additive.

Take a look here at the FPS tutorial as it is a powerful tool to beginners.

I took the section where it enables and disables the muzzle flash. Page 13 of tutorial #2:

 function LateUpdate()
    {
    if (muzzleFlash)
    {
            // We shot this frame, enable the muzzle flash
        if (m_LastFrameShot == Time.frameCount)
            {
            muzzleFlash.transform.localRotation =
            Quaternion.AngleAxis(Random.Range(0, 359), Vector3.forward);
            muzzleFlash.enabled = true;
        if (audio)
        {
            if (!audio.isPlaying)
                audio.Play();
            audio.loop = true;
        }
    }
        // We didn't, disable the muzzle flash
        else
        {
            muzzleFlash.enabled = false;
            enabled = false;
            // Play sound
            if (audio)
            {
                audio.loop = false;
            }   
        }
    }

Notice that it controls when the muzzle flash will be rendered by memorizing the frame number of the last shot, then it will show only for one frame and then will be disabled.

I hope that helps.

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 ptoinson · Dec 02, 2010 at 02:42 AM 0
Share

Awesome. I may use that. Though I have smoke and tracers to deal with as well. But I can see how I may do that. $$anonymous$$y question, however, was more related to the particle system behaviour and the relationship between energy and emission. I was not real clear on that.

avatar image Tuti · Dec 03, 2010 at 12:00 AM 0
Share

Energy is how long your particle will last, the less the value, the less the particle will last. Emission is how many copies of the particle the engine will make, the higher the number, more and more particles you will see be emmited.

avatar image ptoinson · Dec 06, 2010 at 08:38 AM 0
Share

I feel that I understand that. What I'm seeing is that lowering the energy is effecting the emission and I'm trying to deter$$anonymous$$e why such that I can construct a system that has very few particles and I can adjust the emission in a predictable way. What I am, seeing is that with an energy of .01, I have to crank up the emissions to somewhere in the hundreds to get any more the 1 or 2 particles per second showing up in the animation. The docs claim that emissions is particles per second, but with low energies it apparently is not. Why?

avatar image PrimeDerektive · Jan 04, 2011 at 05:01 PM 0
Share

I beg to differ, my particle-system-based muzzle flash looks amazing, and is pretty simple. It's basically a tweaked version of an explosion from the detonator framework that emits with random local rotations and emissions(within a range) through script, and looks pretty sweet.

avatar image
2

Answer by femi · Jan 04, 2011 at 03:10 PM

Energy of 0.01 corresponds to particle life span of 10 ms.

The infamous 25th frame lasted for 40 ms and people claimed not to have seen it. 10 ms would be 4 times as subliminal.

With display refresh rate of, say, 50Hz you only get to see a new picture every 20ms. With sync to vblank turned off your graphics card can render faster then the monitor can display and of each of the frames rendered only a part will be actually visible (some of the particles might end up on those rendered but not shown parts of the frame).

Finally, many of your particles will just die between rendered / shown frames. By increasing the emission you increase the probability that some of the particles will be rendered (will be still alive by the time rendering happens).

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

No one has followed this question yet.

Related Questions

Making gun fire particle 2 Answers

MuzzleFlash for gun 0 Answers

Bootcamp destroy a Enemy 2 Answers

Rotate the textures in the particle system to direction of the particle system? 1 Answer

Gun Muzzle Flash Effect 0 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