Collision Observables Issue with Multiple Physics-Enabled Meshes

I’m encountering an issue with collision observables. I have two meshes (a sphere and a ground) with physics enabled, and I’ve registered collision observables for both.

However, the observable for the second registered object (the ground) doesn’t get triggered. If I comment out the sphere’s observable, the ground’s observable works fine.

It seems they cannot function simultaneously, and I need to disable one for the other to work.

Here is the Playground example: https://playground.babylonjs.com/#Z8HTUN#979

I had never figured out this behavior, but I would say, maybe it’s intended, since it happens only if the 2 objects collide together (somehow, there is only “one” collision, and maybe it’s notified only once, in the first physics body to be registered). I’m not sure that it’s the reason, but it would say that it makes sense since if you want to manage a collision event, you want to manage it one time.


While if you add another sphere : Playground here both collisions (spher-sphere and sphere-ground) are two different collisions, and they are both triggered.


But triggering on both objects anyway, would make sense as well, so… I let team devs say either or not it’s a bug or it’s intended :grin:

1 Like

Very interesting, I’d say it’s a bug. But let’s see. @Cedric

I’ll take a look asap

1 Like
3 Likes

@ertugrulcetin , following @Cedric 's fix, I would say the official answer is : it was a bug. Right ? :grin:

2 Likes

Thank you for fixing it!

1 Like