How to setup a mesh restrcition for solid particle emission


I’m working on a particle animation effect so that particles will emerge within a mesh. Attached below is a work in progress. playground here. It’s almost done, it can emerge as a box mesh, but not more complex ones like cylinder or custom imported ones. Any help is appreciated!

There is SPS digest : Solid Particles From Mesh Facets | Babylon.js Documentation

But I’m not sure it can help here.

Another solution is to query the source mesh geometry and generate SPS particles at the mesh vertex positions.
With the same data, you can query the mesh triangle indices and then, compute particle position inside the triangles.


This PG

is the beginings of having the particles within a cylinder. By no means a perfect example, optimisation definitely needed.

However it might not be what you require as it is based on the mathematics of a cylinder rather than a cylinder mesh and so is not generalisable to a custom mesh.

Another approach that might have some value is

however the interior points are generated randomly rather than in a controlled way.


Example of a degree of control - points generated from center.

1 Like

Thanks! Would you please tell me how exactly shall I extract the outer vertices of a custom mesh? For example, if it’s a humanoid, I would like to extract the vertices around the feet, so that the whole body can be covered by the animation.

I think it would make sense to ask about this as a seperate question to get more answers.

Also custom mesh implies that it is one you have created and hence would know which vertices are which. I believe you are talking aboiut an imported mesh that someone else has created.

One possibilty would be to use a manual method to pick the required facet triangles like this

to find the ones you need before building your app.