let objects vanish and reappear

Hey,

I've been searching around for a while now but found nothing useful on that matter. (Or maybe I'm just too stupid as newbie to implement lines of code into my own one.) So I thought, well, why not try and ask here?

What I need is a possibility to let static objects vanish by pressing a key or a mouse button and reappear after you let go the key. Or at least, by pressing another one or the same key again.

Any ideas how that could work?
Technically, you could just set the graphic's alpha to 0. But, I'm guessing that you also mean that you don't want anything to be able to interact with them...

You can use b2FilterData, and change the categoryBits and maskBits to set what items can interact with (it actually may be as simple as setting the categoryBits to 0.)

If you're using gravity it may be possible to stop that effect by setting the body to be asleep - but I've not tried that...

Original thread: https://box2d.org/forum/viewtopic.php?t=4930