Physics Collision Types

I’m using the “registerOnPhysicsCollide” to detect collisions between two impostors. When testing this I notice it continually calls the callback even when the impostors are touching but not moving (like a sphere touching the ground). I understand this is how it should work since technically it’s still colliding, but is there a way to check if a collision happens once (first time it collides)?

I know in Unity you can use an “OnCollisionEnter” and “OnCollisionExit” and wanted to know if there was something similar within Babylon? If not I suppose I could add in some sort of boolean toggle of sorts to check this myself (possibly more complex for exiting).

@jgonzosan it unfortunately does not exist by default but would be an awesome contribution :slight_smile:

1 Like

Yeah, that could work for detecting how many times something collides. I think for the collision “exit” I could detect if a collision has happened at least once and check the distance between the objects. Would be nice if there was something easier for the collision exit.

Good to know, thanks.