Are you using BABYLON.Mesh.checkCollisions = true in conjunction with BABYLON.Mesh.moveWithCollisions(BABYLON.Vector3) for collisions? If so, this guide on Mesh Collisions might help.
If you could reproduce it on the playground we could see if it is a bug or something you can solve in your code.
As i don’t know what you are importing, it is hard for me to say whether meshes[0] is enough, but seeing what you do i can only assume it is the root of the others.
Just a random question - Why are you setting the root mesh’s bounding info?
@gbz I’ve added some more code from the move() function, and the scene setup. I’ve followed both those guides with little luck. The intersect works, but it doesn’t detect ‘collisions’ it detects if they’re overlapping after the move - so the player will ‘sink’ into the ground when they impact it.
@RaananW It may be something with the Blender model, but I’m not sure what might cause that from a modeling standpoint.
meshes[0] is the ‘root’ mesh that the gltf exporter creates as a parent mesh for the 4 meshes that are in the model (head, torso, arms/legs, eyes). If I turn on the collision detection for all the children it gets weird - presumably because the submeshes actual ‘collide’ all the time.
I’m setting the bounding info on the root mesh b/c it doesn’t appear to ‘get’ any bounding info in the export. So I calculate it based off the children that are exported/imported.
The collisions are sort of detected. Right now, there’s an obvious collision when the two meshes are close (but not touching). Then the moving mesh sort of sinks into the platform mesh.
Here’s what he looks like in the end:
@RaananW@StardustMotion I’ll create a playground with the code, unfortunately because this appears to at least be partially a model export/import issue I doubt I will be able to recreate the entire issue.
So it appears that the ‘sinking’ issue is that the moveWithCollisions function doesn’t first check to see if it’s already collided with a mesh. The ‘gap’ issue I’m having appears to be a scaling issue.
Thanks for your reply. In which way exactly do you mean?
edit: i adjusted the ellipsoid to fit my character, it works fine for the geometry constructed using the MeshBuilder (.CreateBox()). The Problem occurs only on imported geometry. Somehow the problem also Patricks’ described i guess.
Confirmed here that I am also having issues getting checkCollisions = true to work in a predictable way with imported gltf models.
Here’s my playground where as you move around, you slowly sink into the floor before falling to your doom into the playground abyss. https://playground.babylonjs.com/#4HUQQ#1019
It’s like it WANTS to work, but isn’t quite there, heh.
I’ve commented out the nav mesh code in the playground, but it’s interesting that I can create a nav mesh using the nav mesh extension and checkCollisions = true actually works for the nav mesh! You can try that by uncommenting my nav mesh code.
Any idea why checkCollisions might not work for imported models though? It works no problem with grounds or other shapes defined in Babylon, but curious for imported gltf models. @sebavan@RaananW
PS: the model was made in Blender. would one need to set anything on the Blender side in order for the checkCollisions to work on the Babylon side?