Slow physics engine

Taking this example https://www.babylonjs-playground.com/#ILMZVW#9 and while changing the value of “towerLayers” line 114 to get more layers or “slider.maximum” line 155 it results a slow rendering.

Is there any option to render it normally?

@Lokamidou

Using Web Workers can provide allot of resources in calculating physics collisions and other intensive calculations in the linear render loop. @RaananW showed us how some time back. A great tool to learn.

https://blog.raananweber.com/2015/05/26/collisions-using-workers-for-babylonjs/

Galen

1 Like

Be careful as the worker have been deprecated in version 4 but I know @Deltakosh have been planing on tackling threading issues :slight_smile:

Hi guys. Physics have “step” speeds… which can be tweaked.

scene.getPhysicsEngine().setTimeStep(.04); It is easy to get out-of-control with it, which makes it VERY fun!

Nice/Fun scene, by the way. Control-mousedrag gets us to the top of the tower quite easily, where all the action is. :slight_smile: QUITE active, considering sphereImpostor params of mass: 0.05, restitution: 0.05.

Maybe restitution accumulates due to stacks.