Search code examples
unity-game-engineparticle-system

Unity3D - How to have continuous particle emission?


I've recently upgraded my project to 5.6.1f1.

I have a homing missile that tracks a target, and has a particle system attached to it to simulate the smoke.

Before I upgraded the project, the smoke worked well. I had a continuous supply of particles behind the missile that had a nice smoke effect. I forget which version of Unity I used before the upgrade (I think 5.4), but the emission module of the particle system only had a rate setting.

Now that I have upgraded to 5.6.1f1, my particles from my smoke are separated, like the steam coming out of a steam train:

enter image description here

The emission module now has rate over time and rate over distance. I've played around with these settings but nothing seems to adjust to how I want.

I've narrowed down to the fact that my missile is travelling at a very high speed. If the missile travels slower, then the particles look better. But, a missile is a missile and travels fast like my other objects. In the previous version of Unity I was using (I think 5.4), the speed of the missile did not affect the emission of the particles.

So, I guess my question is: How can I have a continuous emission of particles that isn't affected by speed?

(For reference, here is how I want my particles to look, regardless of the speed the missile is travelling) enter image description here


Solution

  • For anyone looking for an answer to the same problem, I found this post.

    "From Unity 5.5 onward, particle system (PS) that uses emission rate over distance or inherit velocity (both heavily used in our particle effect assets) and is parented to a rigidbody (RB) object will appear not functional when you drag the object (with RB component) or change the position values in transform component.

    The reason is that RB velocity has overriden any form of position translation to feed the velocity values to PS modules which require velocity data to work properly. Simply put, you should use Rigidbody.velocity (not even Rigidbody.position which is for detecting boundary) instead of Transform.position/Translate to move the object."

    I simply changed:

    transform.position += transform.forward * speed * Time.deltaTime;

    to

    rb.velocity = transform.forward * speed * 40 * Time.deltaTime;

    Which gave a similar speed and the smoke was not separated.