Is it possible to have a particle system emit from an animated mesh?
for example, let’s say I have a character and I want them to be on fire. So I want to have particles emit from the whole character. Not just some humanoid shape, but the shape they are in in that frame, so if they are flailing their arms around the particle would emit from where their arm is in that frame.
Is this possible? And if so, how do I set it up? Is there a way to set it up so the particle system just uses whatever rmesh it is attached to, or would I need to set up a particle system for each individual character?
There might be some automatic way but I think you can get what you want by making a work mesh, then using this method to bake the mesh each frame to it:
Then you can give that baked deformed mesh to the particle system emission module.
Wow, that was easy, worked like a charm the first time!
Full script:
using UnityEngine;
// @kurtdekker - lets you emit particles from an animated boned mesh
public class test11_particlemesh : MonoBehaviour
{
public ParticleSystem particles;
public SkinnedMeshRenderer renderr;
Mesh m;
void Start()
{
m = new Mesh();
}
void LateUpdate ()
{
renderr.BakeMesh( m);
var sh = particles.shape;
sh.mesh = m;
}
}
3 Likes