How to use trigger (ghost) collisions in havok?

Hello. Is there a way to use trigger collisions in the new havok physics engine?

1 Like

cc @Cedric and @carolhmj

Just to confirm my understanding, you’re talking about a body that fires collision events, but doesn’t affect any other bodies, right? We have shapecasts on our to-do list: [Physics] Check intersection with Shapes · Issue #13873 · BabylonJS/Babylon.js (github.com), with that it would be possible to have this feature.

2 Likes

@carolhmj Yes exactly.
is this feature comming any time soon or we have to wait for it? I’m developing a game and i need it very bad

I plan on working on it after I finish the in progress work on raycast filtering: [Physics] raycast filtering · Issue #13795 · BabylonJS/Babylon.js (github.com)

3 Likes

@carolhmj thank you for your great support.

1 Like

@carolhmj Do you have any workarounds for this right now by any chance? Currently, I want to set filterCollideMask of the collidedAgainst in my collision observer to anything else than the filterMembershipMask of the collider but that doesn’t work. Do you have any suggestions?

The solution I am currently using is to use intersectMesh to handle triggers.
I’ve wrapped a class to try it out if you don’t mind. No after sales service though .

You can simply use Trigger.debugEnable = true to turn debug mode on and off.

He has an onTriggerEnterObservable and onTriggerExitObservable observable. No masks.

1 Like

I have a workaround which is fine for now. At the time I need the overlap test (for causing splash damage to nearby objects) I create a sphere body/shape in Havok, set

shape.filterMembershipMask = shape.filterCollideMask = <mask of objects I want to affect>,
body.setCollisionCallbackEnabled(true);
body.setEventMask(PHYSICS_COLLISION_STARTED);

And I let it sit in the world for exactly one frame, pushing collision events into an array. On the next frame I delete the sphere body/shape and go through the saved up collision events and apply the splash damage on each one.