jsauca Posted December 3, 2018 Share Posted December 3, 2018 Hi, I would like to randomly clone billboard instances onto any meshes template/surface. I could not find much example online and I am now facing an issue that I am still not able to solve. Here is the playground https://playground.babylonjs.com/#532G31#10 Thanks for your help. Quote Link to comment Share on other sites More sharing options...
Guest Posted December 3, 2018 Share Posted December 3, 2018 Hello so you want to clone a billboard mesh and move it to the surface of a target mesh right? In this case your code is almost fine, you just need to random pick vertices from your mesh: https://playground.babylonjs.com/#532G31#11 Quote Link to comment Share on other sites More sharing options...
jsauca Posted December 4, 2018 Author Share Posted December 4, 2018 Hi @Deltakosh, Thanks for your help. As per the playground you have provided you can see that the billboards does not really 'populate' the target mesh. The billboard are placed on the vertices, however the target mesh has really few vertices, hence the generated billboard are duplicating and positioned on top of each others. I started to look into how to subdivide the target mesh to get additonal vertices and get the billboard to be more spead out. However, I have found out that BabylonJS does not provide a way to subdivide a mesh. I am not sure if I am going in the right direction here. Would they be another way to populate a target mesh with billboarda/sprites ? Thanks for your time, much appreciated! Quote Link to comment Share on other sites More sharing options...
trevordev Posted December 4, 2018 Share Posted December 4, 2018 @jsauca do you require them to be placed on vertices? One option might be to find the triangles that make up the mesh and randomly place billboards within those triangles. Quote Link to comment Share on other sites More sharing options...
jsauca Posted December 4, 2018 Author Share Posted December 4, 2018 Hi @trevordev, No I do not require the billboards to be placed on vertices, just anywhere & randomly on the target mesh. I will have a look into how to find the triangles that make up a mesh ! Thanks for your help trevordev 1 Quote Link to comment Share on other sites More sharing options...
trevordev Posted December 4, 2018 Share Posted December 4, 2018 @jsauca here's a playground that might help get the triangles https://playground.babylonjs.com/#KWSAU4#1 Sebavan 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.