For some reason, when importing meshes, the collision when using
moveWithCollisions() seems to be off.
Here is an example with created boxes, which works correctly:
Here is an example with an imported glb file, where the moving box goes through other colliders:
Am I missing some kind of import settings?
I think it’s relative to the mesh being double sided. Not the material but I think all the triangles are doubled?
I checked that with the inspector. Setting the material front sided faces didn’t change anything.
Try again with single sided faces and let me know if it works.
@Cedric Hey thanks for the response! Sadly, this is not the case. I enabled backface culling in the material and used a “merge by distance” in Blender, it did remove multiple vertices but the problem still persists.
You can see the exported GLTF cubes at https://test.zuncreative.com/col.glb
I need to dig deeper. I’ll do it in the coming days.
Thank you so much!
I did some more fiddling around and found that
scene.useRightHandedSystem = true; solves the random collision issue, so the collision might be a problem because the Z scale of the root is -1 because of the GLTF import.
movewithcollisions | Babylon.js Playground (babylonjs.com)
It still feels like the collider boxes are smaller than the meshes even though they are scale 1.
Ho! good catch! it will definitely help me track the issue
The issue is actually the collider(player cube mesh) is still attached to the root (with negative scale)
if you set its root to null, then everything is fine.