Change collision mask of trigger

Hi :slight_smile:

I was wondering, if there is a way to change the collision mask of a trigger, so that it still behaves like a trigger, but only for specific collision groups. For rigidbodies it is easy enough to change it, like the follwing example. But is it possible to set properties like these for triggers as well? = pc.BODYGROUP_USER_1; = pc.BODYGROUP_USER_1;


Nope, unfortunately not. The filtering masks are hardcoded in the trigger and the body object is hidden, so you can’t change it. If your trigger needs to have a different mask you have 2 options:

  1. Create your own body and add it to the dynamics world. You can follow how it is created in trigger. Don’t forget to destroy it, when done using:

  2. Another option is to override collision component system, so that it references your own Trigger class. This is a bit more cumbersome, but works well too.

Please, create a feature request to allow changing filtering masks on triggers:

Thats unfortunate, but thanks again for your quick answer :slight_smile:
I will create the feature request

1 Like

Change collision mask for trigger volumes · Issue #5633 · playcanvas/engine · GitHub