How to efficiently implement cylindric hole physics?

Hi, I’m beginning to work on an online Crokinole game. The point of the game is sliding cylindric pawns into a cylindric hole located in the centre of a gameboard. I would like to ask you for some tips how to implement physics of the gameboard itself.

According to my knowledge there is no way of making hollow physic impostors in babylon so I’m left with only heightmaps or mesh impostors but meshes work only with spheres and i’m using cylindric pawns so am I only left with having to use heightmaps or am I missing something? Please advise me how to approach the problem.

Ammo supports convex impostors vs mesh impostors.
I found an example and changed the plugin to AmmoJS:https://www.babylonjs-playground.com/#1ZQS9W#22
There are occasionally some issues, but I suspect them to stem from CSG. Any reasonably made geometry should work just fine.

2 Likes

Hi, I’ve tried your advice but unfortunately there seem to be some problems in AmmoJS resulting in unpredictable collisions with mesh impostors. Please take a look at a playground that I prepared to demonstrate the issue: Babylon.js Playground
Do you happen to know if there could be something done about it to make it work or is there no hope?

Unfortunately, you’ll have to transpile your own AmmoJS version to include extra functionality, as this is an issue with AmmoJS: Bullet: Bumpy RigidBody to static trimesh collisions · Issue #21341 · godotengine/godot · GitHub
I don’t have my old build anymore.

1 Like

Adding @Cedric who might be interested in taking a look.

Yes, you’ll have to patch an ammojs version and build it yourself.
Ammojs uses an old version of BulletPhysics so I don’t think a contribution will be accepted.
I just tried your PG with Oimo and it works as it should.
Do you have a particular need for ammojs?

I need an engine that supports mesh impostors - the aim of my game is to slide those discs into a hole located in the middle of the bigger cyllinder. Oimo seems to be wrapping meshes into a simple box impostor so I think I can’t use it.

Can you decompose your field with simpler collision shapes like this ?
https://playground.babylonjs.com/#9U1HK9#1

2 Likes

I think it should work just fine. I will make use of your idea. Thank you very much!

1 Like