Trigger Volumes on Compound Rigidbodies

I’m trying to add trigger volumes inside a compound rigidbody but the parent’s collision take that trigger volume as a collision shape so I try to do this

ShipMovement.prototype.setUpTriggers = function () {
    var triggers = this.entity.findByTag('Trigger');

    triggers.forEach((entity) => {
        this.app.systems.collision._removeCompoundChild(this.entity.collision, entity.collision.shape);
        entity.collision._compoundParent = null;

        this.app.systems.collision.recreatePhysicalShapes(entity.collision);
    });
}

but this didn’t working, is there any way to achieve this ?

or is there any way to just take only the collision shapes I need for use as shapes in parents compound shape ?

The collision component does not support it. You would have to move the trigger outside of the compound children. You could place them both (trigger and compound collider) under the same entity, so the transforms would match.

1 Like

Thanks for the reply but this compound shape is a dynamic rigidbody so it moves
is there any other way to detect is player near a entity I mean without checking distance to all, like using picker or something ?

I’m afraid not, no. Another option is to create a ghost object using Ammo API directly and then add it to a compound object that you’d also have to create yourself. However, it is not very straightforward, and you would have to handle collision manifolds yourself.

Every other option, like moving the trigger every frame to the compound position, would be more expensive than just simply checking the distance to it. Unless you have hundreds of those, it should be pretty cheap and I would suggest going for that or consider using another physics engine, like Jolt.

can I use this ?
edit : I guess not, btw thanks for the reply