- Home /
Particle System - moving/adding force to the particles
Hi,
I have created a particle system effect, which only looks good until it is moved at a certain speed. As far as I understand, when simulation space is set to "World", it leaves the particles where they were emitted in the world space, and moves them from there. Instead of making the particles stay behind, I would rather like them to just sort of get pushed back while moving the source. Imagine a candle being carried around - the flame would never stay behind, it would just get slightly pushed in the opposite direction. Calling particleSystem.GetParticles()
should return an array containing the particles, as type Particle, and I am concerned that moving them individually would harm my performance.
Question: Is there a way to add some force, to push the particles in the negative direction of where the object is moving? What would be the least framerate consuming way you can think of?
Thanks in advance!
Edit: I have tried rotating the particle system itself, and set the simulation space to local, but the problem here is the opposite to what I had before: the particle system rotates, and moves the existing particles, rather than having them stay behind. I tried rotating when emission space was set to world, and got the same result. Is there a way to change the direction the particle system emits new particles to, while keeping the existing ones in place?
Edit #2: Done a bit more googling, and found out that the previous system had a way of changing the local velocity through code. In the new particle system (shuriken), it does not appear this is possible. All I see is 'Velocity Over Lifetime' in the inspector, which apparently cannot be accessed through code either. Or is it?
It might give you more of a "fake" look but I had some rotation problems in the past with particle effects. The solution I used is I parented the particle system onto an empty game object and then changed the rotation of the parent (empty game object) rather than the particle system itself. Perhaps that can work for you?
Thank you for the comment. I have just tried doing that, but having the simulation space set to local, it doesn't appear to be any different than rotating the particle system itself. I explained why I don't want to use the world space in the question.
Oh I see what you mean now. I couldn't visualize it at first. I have the same problem, it rotates the already existing particles and looks completely fake. Unfortunately I have yet to solve this myself. I kind of just accepted it. Coincidentally I just thought of a different solution. Ins$$anonymous$$d of rotating/parenting the system what if you added a follow script. Forced it to just follow the game object that is moving. The effect would not rotate but because it's moving the particles should appear realistic?
If I move the particle system when emission space is set to local, it will just move everything as one, and I fail to see how that would make it more realistic. Remember, if I use world space, the particles would stay too far away from the source emitter, if it is moving fast. The only way I can currently think of, is setting the velocity or local velocity, which is not possible in the new particle system. (Edited the question to add this bit of information)
So I did some test and it appears you can use the Legacy particle system to achieve what you want. You can freely move/rotate the particle system and it only effects the NEWLY emitted particles. Any particle that is already emitted isn't effected. Give that system a try.
Answer by LukaKotar · Nov 11, 2013 at 11:03 PM
Looks like I overlooked a field called 'Inherit Velocity' in the Particle System component. It explains what it does as you hover over it with the mouse: "Applies the current directional velocity of the Transform to newly emitted particles." This means that when I move my particle system object, the defined amount of force will push the newly emitted particles, effectively making them stay less far behind, or further behind (depends if the number is positive or negative). 0.7 seems to be a great value for my desired effect.