Physics, Ball falls through my Mesh from 3Ds Max

Can you please help me ? I drawed a roulette in 3Ds Max . exported it with following settings:

Enabled physics in the scene (used this.scene.enablePhysics(new BABYLON.Vector3(0, -9.81, 0), new OimoJSPlugin()) ), made all checkCollision to true , created MeshImpostors . But my ball for roulettte (also created in 3Ds Max ) falls through the roulette. It doesn’t fall through a ground, if to create in Babylon such, but just jumps on it, so physics is seem to be enabled… Also my roulette doesn’t fall itself even if to give it a mass = 10 (so physics doesn’t work with my roulette). So can you help me ? I can’t find a solution :frowning:

https://playground.babylonjs.com/#YIU90M#388

Thank you, waiting for your help

The PG does not work, the models can’t be found:

1 Like

Fixed. Please check again
Waiting for help

Ball falls through roulette | Babylon.js Playground (babylonjs.com)

Will you look ?

For some reason the mesh impostor does not work for the roulette: if you use another type of impostor, you don’t get any error (but the ball still does not collide with the roulette).

Adding @Cedric as I know nothing of physic engines.

The PG was still raising some errors for me, here’s a corrected version:
https://playground.babylonjs.com/#YIU90M#403

1 Like

Okay. Thanks. Waiting for @Cedric help
:grinning_face_with_smiling_eyes:

p.s. you PG doesn’t show anything for me, so just in case put again my link for @Cedric
Ball falls through roulette | Babylon.js Playground (babylonjs.com)

I’m taking a look!

1 Like

That’s because it’s the PG with the MeshImpostor for the roulette. If using BoxImpostor:

1 Like

Now loaded… Previous PG doesn’t show anything at all (just white bgc)

I was able to get physics by adding meshes one by one :
Ball falls through roulette | Babylon.js Playground (babylonjs.com)
I need to check code why meshes need to be unparented.
Also, you need to specify the type of impostor for each mesh you want to physicalize.

2 Likes

So… what can I do to quickly enable physics ? May be I can go through all scene meshes (for of scene.getChildMeshes()) and do mesh.parent = null, make impostor for every ? What can you suggest ?

Yes, you will have to get thru every mesh you want to physicalize and based on its name for example, create the impostor you need.

1 Like

and for my spots ? I should physicalize every spot or every text and rectangle on the spot ?

Yes, that’s a possibility. With collision callback, you’ll be able to detect the rectangle the ball is over.
I don’t how how performant it will be but I think it’ll be alright.

Check this for some more infos:

1 Like
for (let mesh of roulette.getChildMeshes()) {
            mesh.computeWorldMatrix(true);
            mesh.position = mesh.absolutePosition;
            mesh.parent = null;
            Playground.EnableRoulettePhysics(scene, mesh);
        }

will it be okay ? (but it now doesn’t show anything in canvas :frowning: )

or anyway, i can do it manually by getMeshByName(spot${counter})

Thanks, will try to fix :grinning_face_with_smiling_eyes:

2 Likes

@Cedric , help, how now I can animate it ? Roulette must spin and it spinned. But now physics works (thank you for it a lot), but it now doesn’t spin via animation… It also doesn’t spin even if I change spots.rotation in window.setInterval

Let me do it in PG. I will send a link in a couple of minutes