keep object inside an irregularly-shaped one

I have an irregular object (made of overlapping circles and squares) and I want to have objects bouncing around inside the irregular object. Is there a way to create a ‘wall’ around the outside of the object?

I can make circles and squares as walls, but then cannot ‘erase’ the parts that overlap.

With complex geometry I can use drawLine around the outside changing direction when I hit an overlapping part, but that gets really complex with ‘arms and legs’ sticking out.

I tried save and then load the saved image as an outline, but that detects collisions from outside, not from inside.

I tried objects approaching from the outside to detect the edge, but then it doesn’t detect holes in the middle, and I would have to figure how to to connect the points (possible, but not practical, I think).

If it helps, the background is solid color. 

Is there a way to find the outline and make a physics body (static wall) of the complex outline?

Simple is my least favorite word used in the forums.

What you’re talking about is not simple mathematically as it likely involves handling concave collision calculations.

That said, there may be a solution for you to use.

I answered a question before that might apply: https://forums.coronalabs.com/topic/68067-how-to-make-a-circular-boundary

You’ll have to read all the posts I made in the other thread to extract what you need.

The area discussed in this thread was NOT irregular, but could have been if the OP wanted it so.

https://www.youtube.com/watch?v=ayc2HApxOkg

PS - Please try to avoid wall of text posts if you can.  They are hard to read and I tend not to read them through.  Nice short paragraphs, separated sentences, and lists are better for consuming.

Thank you. Using body-chain is better than my drawLine solution.

I have a nice effect on circular parts using 1 point for each degree in drawLine.

Simple is my least favorite word used in the forums.

What you’re talking about is not simple mathematically as it likely involves handling concave collision calculations.

That said, there may be a solution for you to use.

I answered a question before that might apply: https://forums.coronalabs.com/topic/68067-how-to-make-a-circular-boundary

You’ll have to read all the posts I made in the other thread to extract what you need.

The area discussed in this thread was NOT irregular, but could have been if the OP wanted it so.

https://www.youtube.com/watch?v=ayc2HApxOkg

PS - Please try to avoid wall of text posts if you can.  They are hard to read and I tend not to read them through.  Nice short paragraphs, separated sentences, and lists are better for consuming.

Thank you. Using body-chain is better than my drawLine solution.

I have a nice effect on circular parts using 1 point for each degree in drawLine.