I’ve a little question about particles and blendshapes!
I’ve a mesh (skinned mesh renderer) with a blendshape and I use that mesh to emit particles on the vertex. If I animate the blendshape, the particles are emitted from the right places but I’d like to have the particles follow the vertex animation. I set the Simulation Space to Local but the particles are born in the position where the vertex is in that precise time and they stay there (they have zero speed) even if the same vertex is moved by the blendshape.
Someone know how to achieve what I want to do? Like particle parented to the vertex…
Or do you know a trick to fake that?
I think it would be a pretty cool behavior to have so it would be fantastic to have it on the roadmap!
About that “custom piece of script code” do you have some idea to get me started with? I’ll gladly dig into that on my own but I have think about that before write this post and I can’t think of a way to do that right now (even a trick to fake it would be great!).
Another thing I’d like to ask (that could help me to fake it): let’s say my mesh is a simple plane and the blendshape is just all the vertex starting from the center and expanding to their right places (yeah, I could do that with the scaling but just to give the idea ^_^). How can I give the particles a direction from the center to the outside so when they’re born they have a speed and direction that can fake the blendshape movement?
can you get the skinned mesh verts in script? Eg Mesh.GetVertices. I’m not sure if it works with skinning but I guess it probably does
then use Random.Range to pick a vertex
ParticleSystem.Emit to spawn, using EmitParams to place the particle
ParticleSystem.SetCustomData to remember the vert index you are parented to
Then in the update, get the skinned mesh again, (double buffer it) and, for each particle, check how much the skinned vert has moved, and move the particle in the same way using Set/GetParticles
The problem is I have a lot of vertices (like 50k) in a WebGL application, so looping through the mesh in update is too heavy to work in my case!
I managed to avoid the problem making an animation on the scale of the mesh and trying to fake the other effects by classic particles animation!
Another great thing that I could have used, would have been the ability to emit the particles not from all the vertices (or triangles or edges) but from an editable distance from the center!
Well, if you can make the particles parented to the vertices in the blended animation I think that would be a great feature to use!
Can you elaborate on this? I don’t think I understand fully. We have the “Normal Offset” parameter, to spawn particles a given distance from the surface of the mesh, but I suspect this isn’t what you’re asking for?
I’d like to have an effect like this (not with lines but with all the particles, that’s the most similar gif I found! ^_^).
To do this I think I need to know the distance from the center (or from an arbitrary point) and set particle velocity based on this. If I set a curve on “Velocity over lifetime”, the curve is per particle. So a particle spawned on the center and another spawned on an edge would have the same movement!
Or maybe (I hope) is there already a method to do that and I don’t know it?
We don’t have anything for this kind of behavior (I think).
It would be possible to do it via script… with something like:
spawn particles via the Inspector, with 0 velocity (or some invalid value, for identification purposes below)
in script, GetParticles, and, for any with 0 velocity, set the velocity based on whatever logic you would like
SetParticles, and you’re done
We would like to have script API that would only give you the particles born on the current frame, but this is currently on the roadmap, waiting to be implemented…!