How to Detect When Two Physics Bodies Stop Colliding?

I’m currently utilizing the Havok physics plugin. I understand that PhysicsBody provides a callback when two physics bodies collide. However, I’m having difficulty determining when these two bodies stop colliding, or separate. Could anyone provide some guidance on how to get notified when two PhysicsBodies no longer collide?

Any assistance or insights would be much appreciated.

check the line 132~156
This isn’t a handling for two objects are separated
but I hope this helps.


Thank you, as far as I understand the API does not provide a callback for collisions that end?

1 Like

Yes, there isn’t a callback for that. @eoin is this available somewhere that we could expose or is this not a very common use case?

I have a third-person character controller and a terrain, both with physics bodies. When my character jumps, they no longer collide, but when the character falls, they collide. I would like to track this state.

The WASM does write it out; just not exposed to the end interface right now, it looks like.

If you look at CollisionEvent.readToRef, it’s reading a subset of the CollisionEvent (from HavokPhysics.d.ts) from the buffer into a JS struct. The intBuf[0] contains the event type, so there should be events whose type is _hknp.EventType.COLLISION_FINISHED.value, which will be the “stopped colliding” event.

I’ll work on exposing that, then :slight_smile:

1 Like

FYI, we now have an observable for collision finished events! :partying_face: Add observable for collision finished events/trigger events by carolhmj · Pull Request #14109 · BabylonJS/Babylon.js (
It’s a separate observable so it doesn’t interfer on existing code that uses the other collision events :slight_smile:


Thanks! good job!

1 Like


I used the CollISION_FINISHED incident, but no matter what, it was not triggered

    "@babylonjs/accessibility": "6.16.0",
    "@babylonjs/core": "6.16.0",
    "@babylonjs/gui": "6.16.0",
    "@babylonjs/gui-editor": "6.16.0",
    "@babylonjs/havok": "1.1.3",
    "@babylonjs/inspector": "6.16.0",
    "@babylonjs/loaders": "6.16.0",
    "@babylonjs/materials": "6.16.0",
    "@babylonjs/node-editor": "6.16.0",
    "@babylonjs/post-processes": "6.16.0",
    "@babylonjs/procedural-textures": "6.16.0",
    "@babylonjs/serializers": "6.16.0",
    "@babylonjs/shared-ui-components": "6.16.0",
    "@babylonjs/viewer": "6.16.0",

Hey @carolhmj did you update the official documentation for that? So we can check the examples for finished events.

@carolhmj is currently off so be patient she ll be back soon after the summer break.

1 Like

It seems that the onCollisionEndedObservable() has only been implemented in the Havok plugin itself and not on the physics body:
Physics V2 Simple scene with Aggregate | Babylon.js Playground (

Could we have this observable on the physics body too?

Certainly, I can add that :slightly_smiling_face:

1 Like

PR up: BabylonJS/Babylon.js: Babylon.js is a powerful, beautiful, simple, and open game and rendering engine packed into a friendly JavaScript framework. (