ruina Posted August 8, 2016 Share Posted August 8, 2016 Hi, I'm having a problem with physics. Not sure whether I'm doing something wrong or if there is a bug. Look at this snippet: http://www.babylonjs-playground.com/#26LQEZ#14 The box falls to the ground, no problem. But, if you go to line 38 and change this: dice.position.y = 39; with this dice.position.y = 40; and run, the box goes through the ground. Curiously, only happens with some values. For example, with y = 44, the box stops again into the ground, but assigning y values of 50, 51, the issue happens again. And with 52, the box works again as expected. Its a bug of the physics engine? Quote Link to comment Share on other sites More sharing options...
adam Posted August 8, 2016 Share Posted August 8, 2016 You can increase the thickness of the ground collider like this: http://www.babylonjs-playground.com/#26LQEZ#15 or you can make a separate box collider underneath the ground: http://www.babylonjs-playground.com/#26LQEZ#16 Quote Link to comment Share on other sites More sharing options...
ruina Posted August 8, 2016 Author Share Posted August 8, 2016 Interesting, but the box still seems to go through the ground partially. I have switched the physics engine to CannonJs and the box behaves normally no matter the position it starts. I guess that it is a problem of OimoJs. Quote Link to comment Share on other sites More sharing options...
RaananW Posted August 8, 2016 Share Posted August 8, 2016 Yes, this is Oimo's problem. the main issue is the units. take every vector you have (position, size) and multiply by 100, and it will behave differently. Another solution would be to add restitution - http://www.babylonjs-playground.com/#26LQEZ#18 But I am not sure this is what you expect to have. Cannon works much better in that sense. Each engine has its upsides and downsides. webGLmmk 1 Quote Link to comment Share on other sites More sharing options...
adam Posted August 8, 2016 Share Posted August 8, 2016 I just noticed that there is a big difference in the default gravity between Cannon and Oimo. http://www.babylonjs-playground.com/#26LQEZ#14 http://www.babylonjs-playground.com/#26LQEZ#21 That isn't the reason for the issue though. Quote Link to comment Share on other sites More sharing options...
ruina Posted August 10, 2016 Author Share Posted August 10, 2016 By the way, now that i'm aware of the issue, I noticed that this is also happening in the physics demo of the main page of babylon.js http://www.babylonjs.com/Demos/Physics/ You can see at the beginning of the demo a wood box going through the floor like a tomahawk missile Nabroski 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.