Problem is not reproducible or outdated
Particle System Particles Not Following Rotation
Using version 5.2.3f... I have a HeadLookController script that finds a Vector3 to rotate my models head bone to look at. I have a Particle System on a child GameObject of the head bone. The Particle System is set to emit in World Space. However, during runtime, as the head rotates, the child GameObject rotates with it, but the particles that are emitted don't emit from the new rotated forward Vector. This is the ParticleSystem the way I set it up. And this is during runtime, when the character's head looks up, you can see that the GameObject with the ParticleSystem rotated to look up as well, but the particles are still firing from their original position. Anyone have any idea if I'm missing something here? Or does Unity's ParticleSystem not support matching the ParticleSystem's GameObject's rotation?
So, any updates on the question? I assume my workaround did the trick. Please don't keep questions open.
You did set the ParticleSystem's Simulation Space to Local, didn't you?
Sorry to react so late, I didn't get a notification about YOUR comment for some reason.
I'm not sure who you are referring to..the question is about a unsolvable rotation bug when a particle system is a parent of a bone transform. The simulation space doesn't affect that problem. I do not know at which update it was fixed but it is fixed for some time now. Look at my related question.
Answer by Le-Pampelmuse · Dec 17, 2015 at 04:16 AM
Have you bones on your character? Particle Systems are bugged when parented to bones. I had a bug when parenting a particle system to a hand and it would follow movement perfectly but when rotating the character, it was lagging behind. 5.3 fixed it, but now we appearently have this bug.
Try adding a child object to an emoty gameobject, make the particle system a child of that. Rotate it at runtime and it should work now.
You could do a workaround for your case: Make the particle system not a parent of the character but add a script to it that constantly updates it's position and rotation to be the same of the character's head.
Hope this is a tolerable solution for you until this is fixed.
No amount of adding children to a bone seems to make it work. I added one Empty child to the bone, and added the ParticleSystem GameObject as a child of that Empty child. Didn't work. I added an Empty child to the Empty child and added the ParticleSystem GameObject as a child of THAT Empty child...still didn't work. I've done the method where I have an Empty GameObject as a child of the actual Player, and not the bone. This works...however...I can't simply use the transform.LookAt(), because that just pivots the GameObject. Since the head still moves, at some point the flames won't be co$$anonymous$$g out of the mouth anymore. They'll be co$$anonymous$$g from the chin, or the side of the face. So I also have to constantly update the transform.position of the Empty to match that of the mouth.transform. =/
Yes, that's what I wrote. It won't work with bones a parent.
If you can have the player transform be the parent, then LookAt() will still work the same, but, like I said, you will have to match the rotation and position to be the one of the head transform (or Head "bone", because bones are basically just transforms with parent-child relations).
If you want the particle system to always start exactly at the mouth, you can add a public Vector3 to the script, acting as an offset value to the position at runtime and tweak it so it is at the mouth.
For example:
The player is at
(0, 0, 0)
The head is at
(0, 2, 0)
the mouth is at
(0, 2.1f, 0.3f)
which is head.transform.position +(0, 0.1f, 0.3f)
So in the script you would say that the particle system should be at the head position, but add (0, 0.1f, 0.3f)
in the head's local space to that.
To convert local spaces to use in world space you need to use something like Transform.TransformPoint.
Follow this Question
Related Questions
Moving particle system via script causes choppy movement in build but works fine in pay mode 1 Answer
changing the radius of a particle system with unity script 1 Answer
While particle system is alive play animation. 0 Answers
Texture Sheet Animation broken in 2020.3.7f1? 0 Answers
Particle System Prefab on collision? 0 Answers