Sign in to follow this  

Scene won't load in Chrome

Recommended Posts


I switched the physics engine from cannon back to Oimo, and suddenly the scene won't load in Chrome - but loads fine in Firefox. The only changes in code are what @adam added to cause the Oimo extension to behave as expected - with the exception of adding friction to the sphere imposters. I can't even get to the console to see what might be happening. So if anyone has a debugger which might work, and has the time to look at the scene, any info as to why the scene won't load would be invaluable. I must use Chrome to test now as I have to deliver the scene to run in Chromium.

Also, scene.getPhysicsEngine().setTimeStep(); no longer has any effect on the physics engine using Oimo. And this is essential to the client's requirements, as the motion is still too rapid regardles of any setting for this function. I don't want to switch back to cannon, so I hope someone can provide answers - as no debugging tools I have provide any feedback - wierd. Also, If you load the scene, it now takes at least 20 seconds to load, whereas using cannon.js on tokk approx. 2 seconds to load the scene and begin the simulation.

Any feedback on this issue is highly appricited.



Share this post

Link to post
Share on other sites

You have too much going on a single thread and its essentially timing out, you need to do some recursive looping in order to simulate multi threading here so the DOM does not become locked.

Also I find it interesting how your constructing the scene and  did not know you could just do new BABYLON.SCENE without it in a wrapper.


for (var i = 0; i < 700; ++i) {
        var b = sphere.createInstance();
//var b = cell_mesh.createInstance();
        // var b = sphere.clone();
        // zHolds.push(b);
        b.scaling.x = 0.5
        b.scaling.z = 0.7
        b.position.x = (Math.random());
        b.position.y = (Math.random());
        b.position.z = (Math.random(-18, 18));
        // b.position.y += (i+1) * 2.1;
        // b.position.z += Math.random();
        // b.position.z += Math.random();
        // b.position.z = 0;
        b.setPhysicsState(BABYLON.PhysicsEngine.SphereImpostor, { mass: 0.005, friction:0, restitution: 0.9})
        //b.physicsImpostor.applyImpulse(new BABYLON.Vector3(Math.random(), Math.random(), 0), b.position);
        //b.physicsImpostor.applyImpulse(new BABYLON.Vector3(Math.random(0) / 100000, Math.random(0) / 100000, 0), b.position, b.rotation);
        //b.physicsImpostor.applyImpulse(new BABYLON.Vector3(Math.random(), Math.random(), Math.random()), b.position);

        var impulse = new BABYLON.Vector3(Math.random() / 20, Math.random() / 20, Math.random() / 20);
        b.physicsImpostor.applyImpulse(impulse, b.getAbsolutePosition());



    scene.getPhysicsEngine().setTimeStep(1 / 15000); <--- move this out of that loop.

I think you also need to apply the impulse to the mesh that has the physics body not he physics body
b.applyImpulse(impulse, b.getAbsolutePosition());

@dbawel where in Cali are you located? if your not to far from me I could possibly afford a day to come help.

Share this post

Link to post
Share on other sites

I think I understand your problem.

You need to limit the linearVelocity of each body.


If you are sure not to overlap your bodies when you set up your scene, you can probably just lower the initial impulse:

1332 spheres:

with gravity and limited speed:

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.