# How to efficiently implement cylindric hole physics?

**URL:** <https://forum.babylonjs.com/t/how-to-efficiently-implement-cylindric-hole-physics/10137>\
**Category:** Questions\
**Created:** [April 19, 2020, 2:04pm UTC](https://forum.babylonjs.com/t/how-to-efficiently-implement-cylindric-hole-physics/10137 "2020-04-19T14:04:17Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![bpawl](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bpawl/32/7935_2.png) [@bpawl](https://forum.babylonjs.com/u/bpawl)\
**Post date:** [April 19, 2020, 2:04pm UTC](https://forum.babylonjs.com/t/how-to-efficiently-implement-cylindric-hole-physics/10137/1 "2020-04-19T14:04:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Raggar](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raggar/32/20672_2.png) [@Raggar](https://forum.babylonjs.com/u/Raggar)\
**Post date:** [April 19, 2020, 3:34pm UTC](https://forum.babylonjs.com/t/how-to-efficiently-implement-cylindric-hole-physics/10137/2 "2020-04-19T15:34:29Z")

</div>

Ammo supports convex impostors vs mesh impostors.  
I found an example and changed the plugin to AmmoJS:[https://www.babylonjs-playground.com/#1ZQS9W#22](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.

---

<div class="post-metadata">

**Author:** ![bpawl](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bpawl/32/7935_2.png) [@bpawl](https://forum.babylonjs.com/u/bpawl)\
**Post date:** [April 21, 2020, 5:05pm UTC](https://forum.babylonjs.com/t/how-to-efficiently-implement-cylindric-hole-physics/10137/3 "2020-04-21T17:05:44Z")

</div>

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](https://playground.babylonjs.com/#9U1HK9)  
Do you happen to know if there could be something done about it to make it work or is there no hope?

---

<div class="post-metadata">

**Author:** ![Raggar](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raggar/32/20672_2.png) [@Raggar](https://forum.babylonjs.com/u/Raggar)\
**Post date:** [April 21, 2020, 5:31pm UTC](https://forum.babylonjs.com/t/how-to-efficiently-implement-cylindric-hole-physics/10137/4 "2020-04-21T17:31:12Z")

</div>

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](https://github.com/godotengine/godot/issues/21341)  
I don’t have my old build anymore.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [April 22, 2020, 11:09am UTC](https://forum.babylonjs.com/t/how-to-efficiently-implement-cylindric-hole-physics/10137/5 "2020-04-22T11:09:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [April 22, 2020, 3:22pm UTC](https://forum.babylonjs.com/t/how-to-efficiently-implement-cylindric-hole-physics/10137/6 "2020-04-22T15:22:29Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![bpawl](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bpawl/32/7935_2.png) [@bpawl](https://forum.babylonjs.com/u/bpawl)\
**Post date:** [April 22, 2020, 3:58pm UTC](https://forum.babylonjs.com/t/how-to-efficiently-implement-cylindric-hole-physics/10137/7 "2020-04-22T15:58:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [April 22, 2020, 4:13pm UTC](https://forum.babylonjs.com/t/how-to-efficiently-implement-cylindric-hole-physics/10137/8 "2020-04-22T16:13:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bpawl](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bpawl/32/7935_2.png) [@bpawl](https://forum.babylonjs.com/u/bpawl)\
**Post date:** [April 22, 2020, 4:49pm UTC](https://forum.babylonjs.com/t/how-to-efficiently-implement-cylindric-hole-physics/10137/9 "2020-04-22T16:49:56Z")

</div>

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