Selectively ignore rigid bodies?

How ignore rigbody

....initialize
this.entity.collision.on('contact', this.onContact, this);


....onContact = function (result) {    
if (result.other.name === 'Player') {    
NEED IGNORE PLAYER
}
};


Does this help? Collision masks / Groups

unfortunately I still do not understand how it works …

I made a project here to showcase what this does:

https://playcanvas.com/editor/scene/583817

The way masks and groups work is that you do a binary AND between them and if that is not 0 that means these rigid bodies can collide. E.g. a rigidbody that belongs to group 1 can collide with any rigidbody with a mask that has a 1 as its first bit. A rigidbody that belongs to group 2 can collide with any rigidbody with a mask that has a 1 as its second bit etc.

In that demo above the top plane has a mask equal to 1 (binary is 0001) and the bottom plane has a mask equal to 3 (binary is 0011). The box has a group equal to 1 (binary 0001) and the sphere has a group equal to 2 (binary 0010). So the box can collide with both of the planes but the sphere can only collide with the bottom plane.

2 Likes

thx man ! :hugs: :face_with_monocle: