Facing a problem in movement restriction

Hi everyone,

I’m currently working on a configurator project in PlayCanvas and I’ve run into a problem that I haven’t been able to solve.

In my setup, I have multiple sheds, each with different shapes and roof types. Some roofs have 2 points, some 3, some 5, etc., and their scale and position can also change dynamically. On top of that, doors and windows can be placed on any wall of the shed, and they come in different sizes as well.

The challenge I’m facing is making the placement of doors and windows fully dynamic. Right now, I need them to:

* Adapt correctly to different shed shapes and sizes

* Respect the roof boundaries (i.e., no window or door should go above the roof)

* Work with roofs that can change shape, scale, and position

Because of the variety of shed geometries and window/door sizes, doing this manually isn’t feasible. I’ve tried a few different approaches (bounding boxes, simple height limits, etc.), but none of them handle all cases correctly—especially when the roof shape changes.

Has anyone tackled something similar or can suggest a robust approach for:

* Constraining objects within irregular/dynamic geometry

* Detecting roof boundaries in a flexible way

* Keeping placements valid across multiple procedural variations

Any ideas, examples, or pointers would be greatly appreciated.

Thanks!

and many more sheds and windows like this

Distilling it down, it’s a 2D problem of doing a check if all the 4 corners (4 points) of the window is within the polygon of your shed side.

It should be straightforward to work out the polygon shape of your side of your shed based on the different geometries that you have.

It may mean having some metadata to go along with different models you have for the parts of the shed, but it should be all doable.