Is collision shape from glb ignored by BJS?

I make some mesh in Blender. Turned on Rigidbody modifier and set “box” as a shape of collisions for that mesh objects. My mesh is not box-shaped but it’s just for a test.
Then I exported it as glb and loaded in BJS. Tested to check its collisions with moveWithCollisions().
To my surprise my box-shaped collider from Blender was ignored. Instead of it I see that now it’s like mesh collision shape or “convex hull”. Looks like BJS creates collisions when it loads the mesh?

So how to create collisions for complex objects?

My version is:

const collisions = result.meshes.filter(x => /col_/.test(x.name));

collisions.forEach(collisionItem => {
  collisionItem.checkCollisions = true;
  collisionItem.isVisible = false;
});

here I get all meshes that names starts with “col_” and define them as collisions.

If you use rigidbody probably, add some code to define parent relations, I think.

1 Like

And also check this playground with physics impostor Babylon.js Playground

2 Likes

If I got your idea right, you create additional meshes for being just collisions for your main meshes and make those collisions-meshes transparent?

Correct. I am not a specialist but as I know – this is common way to do this.

1 Like

AFAIK colliders are not exported as part of a glb export. To be more specific - the meshes might be exported but we don’t set them to be collision-enabled per default. However, @bghgary knows that better and will be able to answer this specific question better than me.

@Dok11 's solution is very straightforward and would be my solution as well.

1 Like