How to use MeshImpostor with blender imported glb?

Hi everyone,

I’m struggling with physics and collision with imported glb from blender.
I think there is something I have missed. I try, has this example show, to make a ball bounce on the goal of the basket (mesh[2] in my code) but it’s like the physics impostor isn’t even here.

I want to use the MeshImpostor type of impostor because, as it is a bended cylinder, I don’t want to redraw on using Babylon native mesh as I’m not sure it is possible.

I tried to put this impostor directly on the mesh in the physicsImpostor key and to wrap the mesh in a group and add the impostor on the group but none of those solutions worked.

I was thinking that maybe I forget to add something in Blender but, as I am a beginner in both 3D, Babylon and Blender I don’t know what it could be.

I uploaded an example of what I done here Babylon Template
I would have uploaded it in the playground but I don’t know how to import .glb files in it (I’m interested on how to do that if you know).

I want to precise that I imported my glb file in the babylon sandbox and it seemed ok to me.

To wrap up here is my precise question : How to use MeshImpostor with an imported Blender .glb ?

Pinging @Cedric

1 Like

I tried to import a .babylon instead of a .glb and it work well know :slightly_smiling_face:
Do anyone know if it’s normal ? ( I didn’t found something about it in the doc but I could have missed something )

It should work the same but the glb structure is not the same (with intermediate nodes)

Hi @Deltakosh :slight_smile:
That’s what I thought. I tried again today to make it work with a glb model but couldn’t.
Here is an example Babylon Template

As you say I noticed that the structure of the mesh I get with BABYLON.SceneLoader.ImportMesh is different (there’s a root element on [0]) but I don’t understand what it could change as I’m not using it.

As with the .babylon, with the .glb I put the physics on the bended cylinder (the goal) so I think the problem don’t come from what I do with Babylon JS (feel free to tell me if i’m wrong, i’m fairly new to 3D and Babylon).

Maybe it come from the .glb export made from blender ? Or maybe it come from a different way of “activating” physics on a meshe contained in a .glb in Babylon ?

I cannot speak for .glb, but the .babylon exporter uses the collision_shape property to transfer imposter, shown being set below.

Not quite sure this forum is really the place to really get answers to Blender / .glb questions. You could search for .rigid_body.collision_shape existing somewhere in the source code of that exporter to verify it is actually sending it.

Can you check this doc and try to repro in the PG?