Sem
June 15, 2020, 12:37pm
1
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!
JohnK
June 15, 2020, 1:04pm
2
This will provide you with surface points on a mesh you can then position your SPS particles on those points.
https://doc.babylonjs.com/snippets/surfacemeshpoints
1 Like
Sem
June 15, 2020, 1:11pm
3
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?
JohnK
June 15, 2020, 1:13pm
4
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
Sem
June 15, 2020, 1:14pm
5
Cheers! Thanks for the quick help man! I’ll go make some fine trees now
JohnK
June 15, 2020, 1:19pm
6
1 Like
I think creating a fixed number of random points could be useful too:
https://www.babylonjs-playground.com/#NFSGWT#17
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