How to place SPS particles on the surface of a mesh like PCS particles?

Looking at this 80k building demo I thought it would be cool to see trees on a mesh landscape using that solution.

The PointsCloudParticleSystem(PCS) provides a fancy function called addSurfacePoints where it places particles on the surface of a mesh. The SolidParticleSystem(SPS) does not as far as I can see.

Do I need to create a custom position function to achieve the same effect, or is there an easier way that I overlooked?

Any help appreciated!

This will provide you with surface points on a mesh you can then position your SPS particles on those points.

1 Like

If I understand correctly, just generate a Vector3 array using that function, and place the particles with a custom position function that’s looping through the array?

Yes, if you look at the PG example on that page it does it with sphere meshes. You can do the same with SPS particles.

1 Like

Cheers! Thanks for the quick help man! I’ll go make some fine trees now :smiley:

Perhaps this might be of interest Adding Objects to a Dynamic Terrain - Babylon.js Documentation

1 Like

I think creating a fixed number of random points could be useful too:

For each triangle, the number of points to create depends on the triangle area over the total area (sum of all the triangle areas).

1 Like