Jump to content

Scene won't load in Chrome


dbawel
 Share

Recommended Posts

Hello,

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.

http://qedsoft.com/DEMOS2014/PE_KYP/index5.html

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.

Cheers,

DB

Link to comment
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.

also

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);
        impulse.normalize().scaleInPlace(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.

Link to comment
Share on other sites

I think I understand your problem.

You need to limit the linearVelocity of each body.

http://www.babylonjs-playground.com/#1MJ09V#17

edit:

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

http://www.babylonjs-playground.com/#1MJ09V#22

1332 spheres:

http://www.babylonjs-playground.com/#1MJ09V#24

with gravity and limited speed:

http://www.babylonjs-playground.com/#1MJ09V#25

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...