splash27 Posted May 6, 2018 Share Posted May 6, 2018 The problem is here: https://www.babylonjs-playground.com/#RAYW6X My mesh partially goes through the floor while the physicsImpostor is applied. Can I correct it's behavior on my mesh? Quote Link to comment Share on other sites More sharing options...
JohnK Posted May 6, 2018 Share Posted May 6, 2018 A search for "through floor" in the forum seems it is a common problem with physics engine. Happens when you object is too small. Need to scale up the object. Just how small you need to go you will have to experiment with https://www.babylonjs-playground.com/#RAYW6X#1 Quote Link to comment Share on other sites More sharing options...
Raggar Posted May 6, 2018 Share Posted May 6, 2018 In this case, it looks like the merging of the meshes messes with the impostor system. It creates a single shape with the following halfExtents: x: 0.1 y: 0.30000000596046444 z: 0.5000000029802323 And this does not quite match the L-shape you are trying to achieve. What you want to do instead, is create a compound-shape by using the parent-child system in BJS: https://www.babylonjs-playground.com/#RAYW6X#2 Quote Link to comment Share on other sites More sharing options...
splash27 Posted May 6, 2018 Author Share Posted May 6, 2018 @Raggar, great! However parenting system is not comfortable in cases of spawning instances. You'll have to create instance for every child and attach impostor for every child. Can I fix halfExtents manually after merging meshes? If yes, how I can do this? I can't find such property in Impostor's properties. Quote Link to comment Share on other sites More sharing options...
Raggar Posted May 6, 2018 Share Posted May 6, 2018 In that case, the pistol will only be represented by a box, and not a compound shape like an L. Quote Link to comment Share on other sites More sharing options...
splash27 Posted May 7, 2018 Author Share Posted May 7, 2018 If dropped pistol will act like a box in Physics world this is not a big problem in my simulation. It should looks like compound shape however the box-like colliding is a compromise that I can accept. How to do this? Quote Link to comment Share on other sites More sharing options...
splash27 Posted June 24, 2018 Author Share Posted June 24, 2018 My solution: https://www.babylonjs-playground.com/#RAYW6X#3 It's a little bit similar with solution by @Raggar, however less expensive and more universal (I think). Yeah, the main disadvantage is simplifying physics till bounding box, but it can be accepted in my case. Anyway, it still looks like a hack. I wonder if merging algorithm can be fixed inside Babylon's core. 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.