Mesh CheckCollision but pass thru other mesh

Hey guys… im trying to figure out if i can make some sort of Trigger Volume feature using the mesh.onCollideObservable.

I need to create a box with mesh check collisions enable so i can get the mesh.onCollide obserable event and hand my collision detection with the other mesh… works perfect but cant pass thru the other mesh (which is what its support to do). I need to pass thru object and still get collide event … Like a trigger volume from unity or unreal.

in Ammo.js i would set a collision flag (CF_NO_CONTACT_RESPONSE) to allow passing thru but still get collision events

if (trigger === true) body.setCollisionFlags(body.getCollisionFlags() | BABYLON.CollisionFlags.CF_NO_CONTACT_RESPONSE | BABYLON.CollisionFlags.CF_CUSTOM_MATERIAL_CALLBACK);
else body.setCollisionFlags(body.getCollisionFlags() | BABYLON.CollisionFlags.CF_CUSTOM_MATERIAL_CALLBACK);

Anybody got any ideas i can handle something like this with the Check Collision System
???

Adding @RaananW and @Cedric in case they have an idea :slight_smile:

There are collisionGroup and collisionMask but this will disable collision,


To disable collision response, AFAIK, a new flag and test is needed here to move the move whether there is a collision or not:

So what do you say @Deltakosh … Can we get this in there… Pretty please :slight_smile:

I see no problem at all!

1 Like

So @Cedric … Where should put the collisionResponse flag ???

Do you wanna go ahead and make the PR ???

That would be awesome :slight_smile:

1 Like

I can do that!

1 Like

PR is live, let me know if I got you wrong with this flag :slight_smile:

2 Likes

Merged!!

Yo @Cedric … thanks for making the PR… Going to try it out tonight

1 Like

Hello, thanks for this update, exactly what I needed!

Would it also possible to detect when a collision leaves?
for example detecting when entering and leaving a trigger mesh

Previously I was checking for if intersectsMesh is false, but needed more accurate detecting than a bounding box

EDIT:
Will try a custom check with Check When a Point is Inside a Mesh | Babylon.js Documentation and see how it goes

1 Like