What is the correct way to temporarily hide a sprite with a physics body?

I have a sprite (A) which has a physics body, to which is attached the physics bodies of several other sprites (B,C,D) via FixedJoint

Each of (B,C,D) has their own physics bodies etc.

At any given point in time, I want to display only one of B,C,D, and only that body should be collidable. So maybe right now I want B to be displayed, but later on C, but the disabled / invisible sprites physics should not affect the world (collisions), but is ok if its mass still exists and affects objects it is attached to…(so total mass acting on A is always same, since the fixed joints still exist)…

What is the best way?

I have considered the following:

  • Removing / Creating B,C,D so only the required one exists in the world. This seems a bit heavy
  • Reseting / Setting the collision and contact bit masks of B,C,D and making the sprite invisible… and maybe making B,C,D have no mass. Only A will have Mass, so B,C,D will not affect physics of A, except of collision / contact detection…

I am wondering:

  • Is there a way to just make both the sprite and the physics body non-collidable easily ? I know sprite I can set the transparency? But what about the physics body…

I don’t quite understand but you could always use setVisible() and maybe removeFromParent() depending on your needs and then removeFromParentAndCleanup() if you are entirely done with the object.