Adding Collisions to Imported GLB File

Hi all,

I have been looking all over the forums for a week now looking for a good way to add collisions to wall that my camera and player object can collide against… If the camera clips, I can live with it…

I found this demo which is way bigger than the GLB room I am trying to import, but is a perfect example of what I need. I see this demo is using a XRHelper? is that it?
https://www.babylonjs.com/demos/glowingespilit/

Currently I am able to move the camera or player with WASD/Arrow keys, but currently they player just clips through the wall. Which I can not have… I have enabled collisions on my Wall mesh objects but they work more as a trap than a wall or barrier. I can keep going forward to the point where the player mesh’s center is now in the middle of the wall. Ive tried loading a Physics engine but Im currently using Angular and typescript definitions and compatibilities are a nightmare… I’ve seen a few posts explaining it but I still rather not add the physics engine right now.

Ive tried flipping the overrideMaterialSideOrientation from Front to Back and even both… I even cloned all my wall meshes and then had 1/2 with Front and the other 1/2 Backwards.

Is there any way to have collision meshes pre-baked into a GLB file? Or any suggestions on how to make the walls work? Also is that demo code public? I found a JS file using inspect element but it didnt have any guts (real code) :L

I will try and create a playground example to show my issues and progress… I feel like I’m so close… I figured out importing animations and I though collisons was gonna be easy :frowning:

Thanks,
YungTech

There is no automatic way to create phyics from gltf. there is no info in the gltf for this.
There are some threads like this:

as well as a playground:

https://playground.babylonjs.com/#R791PH#15

1 Like

After some playing around… I was able to import Ammo.JS without getting a Webpack error… I will release a template of a Babylon NG project with AmmoJS Physics

I install Webpack 5.56.0 and then ran npm i --package-lock-only.

5.50.0 also works