Triangle shape made of spheres

Does anybody know how to make a triangle shape based on this example https://www.babylonjs-playground.com/#ILMZVW#9 (just instead of square shape, would be great to have a triangle form like a small mountain. All the rest work fine.)

hey sorry for late
https://www.babylonjs-playground.com/#G44L79#25
look this sample that is not sphere but can help you

https://www.babylonjs-playground.com/#G44L79#26

https://www.babylonjs-playground.com/#G44L79#28

https://www.babylonjs-playground.com/#G44L79#29

1 Like

Cool, it seems even better than I was planing :slight_smile:
I have never worked with GeometryBuilder, so I am trying to get an idea from your code. Just one thing: I tried to add a GUI Slider but I am wondering how to change the value. Here is the example that I wanna to follow https://www.babylonjs-playground.com/#ILMZVW#9
So to build the “mountain” that you created, what can I implement on slider.onValueChangedObservable.add function?

https://www.babylonjs-playground.com/#6DIUEB#1
?

The Math is way off and will only work for a stack of 5 currently… If I had more time Id do the real calculations for you but this should get you on the path I would imagine.

https://www.babylonjs-playground.com/#6DIUEB#3

?

4 Likes

yuuup! that looks amazing :wink:

The height calculation could be messed with… I got lazy and just did the radius*0.65… what is really needed is a hexagonal circle stacking offset for those ones and I forget the value for it…