A lot of fun with babylon js and specially with physics engine
I am looking how to do tower/building on a empty ground with spheres. This picture shows exactly the situation:
I saw a lot of PGs and docs that explain how to do physics engine, here for example is this the famous one https://www.babylonjs-playground.com/#7149G4#0, then I thought to push the spheres to the same position, I guess something like this https://www.babylonjs-playground.com/#A2WGF, but this idea wonât create the shape that I am looking for! Is there any other way to work on it?
Oh great! it looks we are close
So, to make this box shape I would like to render the action of building by using range slider. Meaning - I start from empty ground and by changing the value of the slider, balls will start to attach each other. The more I move the slider, the more balls will build the box and the opposite when I move back the value of slider, the balls will go away from the box.
Do you have any idea?
PS: I am still newbie
Well this is quite simple now given that you have the final tower done:) your slider will just add ball one by one instead of using my 3 loops for x y and z
I think first I should find how to add balls one by one(or can be more), letâs have a look here https://www.babylonjs-playground.com/##5HNBAJ, I added a loop just running twice the box shape that you created. It looks so ugly, but the way how balls fell down is not bad. Still I am looking how to get the engine starting from empty ground, it means I wanna render only the collision that will build the box.
Could any one help me to render better that example https://www.babylonjs-playground.com/#ILMZVW#1. I did 3 loops of creating box shape, by starting the running, the balls move from the ground to up and then fell down again but I would like to have them moving from up to down directly.
Hi @Lokamidou
Each of your createSphere calls, additionally contained a loop of creating 3 spheres, in the same location.
removing that also removes the majority of the bouncing.
@aWeirdo Perfect thank you! So now I can continue by adding a range slider that will update the creation of the shape. Do you have any idea which option is better if I use the Babylon GUI Slider or simply HTML. I checked, there is not a lot of Babylon GUI sliders examples.
Could any of you help me to solve this problem: when I change the value of the slider into the right side I want the tower of the balls increasing into the top. The same way when I change the value of the slider into the left side I want those balls to decrease accordingly.
I wanted to use the same concept but this time with imported mesh, so I tried with skull.babylon https://www.babylonjs-playground.com/#773IB4, only âcreateLayerâ is working (function line 56). The dispose function (line 89) dosenât work. When I apply anything (mesh, box, sphere âŚ) inside the SceneLoader, the dispose function dosenât work. Should I import first the mesh, and then some how call it or how?
now if you can solve the restitution glitch where you have a bunch of physics imposters stacked in a chain or stacked like that in Deltas scene then you would be an amazing person. Cause right now if you get to many imposters interacting in a row the restitution builds up and builds up till things break.