Custom collider with matter physics

I’m working on a physics puzzle game heavily influenced by “The Fantastic Contraption”.

The player can add sticks to the scene. If the sticks cross each other, there should be a joint where they cross.

I’ve got the joint part figured out, but now I should make it so that the sticks which are jointed do not collide with each other (otherwise the physics go bonkers as the joint and the ongoing collision compete). The sticks should collide with any other objects in the scene.

So with two sticks I can just add them both to a negative collision group, but one stick can only have one collision group (correct me if I’m wrong). But the stick should be able to have joints with multiple other sticks.

So if we have 3 sticks a, b and c and a+b and b+c have joints, a and b shouldn’t collide, b and c shouldn’t collide, but a and c should.

How would you go about sticking this? :sweat_smile:

While waiting for approval for this post I I took a closer look at the collision categories and makes.

Seems that don’t setting own category for each object and then seeing the masks so that the joined pairs don’t collide could do the trick. Although this will be limited to 31 objects but I guess that’s quite many :slightly_smiling_face:

Does that sound reasonable?

That worked, so nevermind :sweat_smile: