Borislav Posted April 8, 2017 Share Posted April 8, 2017 I try to make a ball move with collision but it doesn't work! It does work with only one of the grounds. Code: //ground var ground = BABYLON.Mesh.CreateBox("box",2, scene); ground.material = Mat2; ground.position.y = 1; ground.rotation.x = 4; ground.scaling.x = 10; ground.scaling.z = 0.125; ground.scaling.y = 10; var ground2 = BABYLON.Mesh.CreateBox("box",2, scene); ground2.material = Mat2; ground2.position.y = -10; ground2.position.z = -10; ground2.rotation.x = Math.PI / 2; ground2.scaling.x = 10; ground2.scaling.z = 0.125; ground2.scaling.y = 10; ground2.physicsImpostor = new BABYLON.PhysicsImpostor(ground2, BABYLON.PhysicsImpostor.BoxImpostor, { mass: 0, restitution: 0.9 }, scene); ground.physicsImpostor = new BABYLON.PhysicsImpostor(ground, BABYLON.PhysicsImpostor.BoxImpostor, { mass: 0, restitution: 0.9 }, scene); sphere.physicsImpostor = new BABYLON.PhysicsImpostor(sphere, BABYLON.PhysicsImpostor.SphereImpostor, { mass: 1, restitution: 0.9 }, scene); return scene; Please help! Thank you, Borislav. Quote Link to comment Share on other sites More sharing options...
wo997 Posted April 8, 2017 Share Posted April 8, 2017 Make a playground with it to let people solve it faster Quote Link to comment Share on other sites More sharing options...
Borislav Posted April 8, 2017 Author Share Posted April 8, 2017 http://www.babylonjs-playground.com/#OB0LJ#11 Quote Link to comment Share on other sites More sharing options...
wo997 Posted April 8, 2017 Share Posted April 8, 2017 @Borislav I can't solve it, I left babylon.js just because of those glitches, at least I didn't like cannon.js, try using oimo.js and it should work. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted April 9, 2017 Share Posted April 9, 2017 http://www.babylonjs-playground.com/#OB0LJ#14 I have problems, too. (I did some adjusting and reduced gravity much) Looks like invisible impostors are there. hmm. I will keep thinking, and do more tests. Stay tuned. update: working better in BJS 2.5 version of playground: http://www.babylonjs-playground.com/index2_5.html#OB0LJ#14 hmm. Ooops... the 2.5 playground SAVE isn't working, or I'm doing it incorrectly. hmm. Just paste the code from the first URL, into the blank second URL editor, and hit run. Better ball bounce. Quote Link to comment Share on other sites More sharing options...
Borislav Posted April 10, 2017 Author Share Posted April 10, 2017 On 09.04.2017 at 6:28 AM, Wingnut said: http://www.babylonjs-playground.com/#OB0LJ#14 I have problems, too. (I did some adjusting and reduced gravity much) Looks like invisible impostors are there. hmm. I will keep thinking, and do more tests. Stay tuned. update: working better in BJS 2.5 version of playground: http://www.babylonjs-playground.com/index2_5.html#OB0LJ#14 hmm. Ooops... the 2.5 playground SAVE isn't working, or I'm doing it incorrectly. hmm. Just paste the code from the first URL, into the blank second URL editor, and hit run. Better ball bounce. I am still having a problem. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted April 10, 2017 Share Posted April 10, 2017 Hi B! Did you switch to BabylonJS version 2.5? I think you should, for now. Other versions are showing physics issues, such as the one you found. I made another version of the non-2.5 failure. http://www.babylonjs-playground.com/#OB0LJ#17 Still trouble, as you see. BUT, when I paste that code... into http://www.babylonjs-playground.com/index2_5.html#OB0LJ#14 editor (a blank editor with 2.5 BJS as core)... and hit RUN... the physics look good again. Try it. Load this... you should see blank editor. Paste code from THIS playground... into that blank editor, and click RUN. Look ok? Looks good on my machine. Good ball bouncing, and I added an automatic "return ball to starting position" -feature... for when sphere falls too far. Unfortunately, I still cannot SAVE 2.5 version playgrounds. BJS team is working-on that issue right now. But, you should use BJS 2.5 for now (for non-playground or at-home projects)... so your physics work correctly. Stay in touch, tell us progress, please. thx. Let's ping physics expert @RaananW, in case he wants to monitor our conversations. Talk again soon. Quote Link to comment Share on other sites More sharing options...
Borislav Posted April 11, 2017 Author Share Posted April 11, 2017 22 hours ago, Wingnut said: I made another version of the non-2.5 failure. http://www.babylonjs-playground.com/#OB0LJ#17 BUT, when I paste that code... into http://www.babylonjs-playground.com/index2_5.html#OB0LJ#14 editor (a blank editor with 2.5 BJS as core)... and hit RUN... the Quote Link to comment Share on other sites More sharing options...
RaananW Posted April 11, 2017 Share Posted April 11, 2017 Hey guys, this is happening due to a new way to calculate the extend size of the object. So far it worked correctly, the problem here is the rotation (that should be supported, of course). A quick solution is this - http://www.babylonjs-playground.com/#OB0LJ#19 I will work on a global fix for the entire framework. Wingnut 1 Quote Link to comment Share on other sites More sharing options...
RaananW Posted April 11, 2017 Share Posted April 11, 2017 PR submitted, it will soon be integrated in the framework. Here is a working demo of the fix - http://www.babylonjs-playground.com/#OB0LJ#20 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 11, 2017 Share Posted April 11, 2017 PG updated Quote Link to comment Share on other sites More sharing options...
Wingnut Posted April 11, 2017 Share Posted April 11, 2017 Nice work, guys, thx! 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.