dbawel Posted October 19, 2016 Share Posted October 19, 2016 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 Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted October 19, 2016 Share Posted October 19, 2016 Running a system monitor, memory use grows dramatically. I cannot even get Firefox to work. I need more memory. My swap quickly ramps up. Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted October 19, 2016 Share Posted October 19, 2016 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. dbawel 1 Quote Link to comment Share on other sites More sharing options...
adam Posted October 20, 2016 Share Posted October 20, 2016 17 hours ago, dbawel said: as the motion is still too rapid regardles of any setting for this function can you explain this some more? Quote Link to comment Share on other sites More sharing options...
adam Posted October 20, 2016 Share Posted October 20, 2016 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 dbawel 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.