Ammo.js collision helper

I’m having problems with making a custom mesh match a triangle shape I created for collisions but I can’t understand what’s happening exactly. Is there a way to see some lines or other visual aids that could let me see the actual collision shape rather than having to throw objects at it and trying to guess?

Have you tried enable3d.io? It has a Debug Drawer for ammo.js included.

Take a loot at the examples: https://enable3d.io/examples.html

2 Likes

Thanks I’ll have a look tomorrow. I tried to include the script in my three.js script but there’s a problem with MIME, same if I download the whole site and run individual examples directly from there. I have to go though so I’ll check tomorrow

I managed to implement it into my document (three.js+ammo.js). Is there a way to use the debug drawer in that document or would I need to substitute the parts written for ammo to enable3d? I tried using debug.enable on my ammo physics world for example but it doesn’t work

I also tried to add a gltf loader to one of the three.js physics extension method examples to see how the debug would work on imported models, but I can’t make it work. If I use a THREE.GLTFLoader it tells me it’s not a constructor, if i use a THREE.Loader the model doesn’t show up

Also, does it support cloth simulations?

I just made an example with the GLTFLoader and Physics Debugger:
https://enable3d.io/examples/gltf-loader-with-physics.html

Not yet, but I plan to add it in version 22 or 23.

1 Like

Thanks a lot. Also, the fact that I can easily create the shape for the physics simulation with 1 line rather than having to manually cycle the vertices is awesome, I can’t wait to see the cloth simulation

Would it be possible to use ammo besides enable3d for the cloth part or something similar as a temporary solution?

Yes, you have access to all ammo features. The enable3d physics extension is only a wrapper around it.

But the ammo.js files on the enable3d website or repo does not include softbodies. But you can easily just replace it with the one from kripken GitHub - kripken/ammo.js: Direct port of the Bullet physics engine to JavaScript using Emscripten.

Update: Hmm, or maybe not. I guess I would first have to change the code slightly. Anyways, it’s on my todo list :slight_smile:

Understood, I guess I would have to initialize the ammo physics separately for the soft bodies? But then I wouldn’t be able to make them interact with the bodies I created with enable3d, or is it something else?

I played around with it a bit. It’s actually pretty easy to add soft bodies to enable3d. I just had to change a few lines. I will publish it with the next release of enable3d.

Thanks. I don’t want to rush you, but would you know when you’re going to release the new version more or less? Just as an indication, not an exact date, otherwise it’s ok

About 2 weeks I guess.

I just need to fix 2 bugs (Issue 61 and 62) and integrate post-processing. Maybe you want to help?

Thanks for the info. I’d be glad to help where I can but I don’t have a lot of experience in such things

It is now ready. See: SoftBody Cloth

1 Like

Thanks, I’ll try it in the next few days