I made a function to create all physics impostors in one place for all meshes (tell me if you think this is good pattern) and I cant figure out why sometimes physicsImpostor.physicsBody is undefined. It looks as it is somehow asynchronous because when i console.log it in line 24 its undefined and line after when I log physicsImpostor i can get to the value of the body in console. I added if statement and it works and sets the collisionFilterGroup correctly for all 3 impostors but if you remove line 27 the code will crash.
Here is the playground demo
I also tried to clone physics impostor then I clone the mesh in line 48 by passing true as 4th parameter but this doesn’t seem to work. Would be handy
thanks in advance