Rigidbodies - Mass - Joints - IgnoreCollisions not working

I have a tank with 3 rigidbodies and with configurable joints locking them to one another.

Body<–Turret<–Cannon are linked together with configurable joints. The turret rotates on X and the cannon rotates on Y (the joint makes the cannon rotate with the turret on X). When the cannon collides with something that has a higher mass than it, it pulls away from the joint and goes springy. SO, if I just make the cannon’s mass large enough, this should not happen when it collides with lower mass objects. HOWEVER, the cannon does collide with the body at times. The body is 55X heavier than the cannon and must stay that way, otherwise the tank tips over or even flips. So I thought of Physics.IgnoreCollisions.

First let me ask if Physics.IgnoreCollisions even does what I think it does: When the cannon collides with the body, I think I can tell it to ignore the collision and the cannon will pass through the body. Is this correct?

If this is the case, then here is the error I am getting:

Ignore collision failed. Both colliders need to be activated when calling this IgnoreCollision

I have checked and the “.collider.enabled” returns true for the cannon, turret, and body. Is enabled the same as activated?

Why am I getting this error on

public Rigidbody transform1;
Physics.IgnoreCollision(rigidbody.transform.collider, transform1.collider);

I, in essence, want to ignore collisions that any rigidbody has with any collider in this instance of the prefab. However, I don’t want it to ignore collisions with a separate instance of the prefab, only self. The tanks need to be able to run into each other and they are all on the same layer.

To put it another way, if my arm hit my body, I would want it to pass through me like a ghost. But if my arm hits you, I want it to collide.

First of all IgnoreCollisions handles the collsitions between two colliders. If one of your rigidbodies has more than collider you would need to use IgnoreCollisions between all colliders that shouldn’t collide with each other. Keep in mind that this method can only be called from the main thread (so use it in Awake, Start or a manual “Init” method). IgnoreCollisions only works if the gameobject with the collider is active. If a gameobject is deactivated it’s like it’s not there at all (from the renderer and physics point of view)

However the usual approach for tanks is to only have one rigidbody. The turret would be a child of your tank and the cannon a child of your turret. The collider for your tank should enclose everything (at least at resting position). You usually would use a few box colliders (also a child of the rigidbody).