Using physics engines with collision detection

Hello, to my understanding most of the physics engines are limited to only support collisions between planes, boxes, spheres, and some other variations of simpler based meshes. So it seems most people would implement GLTF or GLB models inside of these simpler meshes to get close to the physics they want.

That is great, but what if I want to implement ground that is terrain based? I understand that collision detection doesn’t necessarily work with GLTF or GLB models in this instance. So would it be better to use a mix of planes that roughly reflect the terrain? I can’t help but feel it would never be perfect.

My hope is that I’m misunderstanding and that maybe some physics engines can use GLTF models but I have not seen any examples of terrain, but I did see something close in the ammo js engine.

Hello! Maybe this https://enable3d.io/

1 Like

Here you go:

See the 5th example:

https://boytchev.github.io/Physijs/examples/heightfield.html

1 Like

Thank you for this. I was hellbent on figuring this out through three js, and was initially skeptical of using this. However, after taking a second and third look this really looks like a phenomenal project for what I’m trying to do.

1 Like

You have many options. Here are just three

Using CANNON.Trimesh : https://ball-vr.sbcode.net/

Using CANNON.Heightmap : https://sc.sbcode.net/

Using Threejs Math Octree : FPS Octree - React Three Fiber Tutorials

And there are many more options.