How to align objects with slanted / inclined faces (on the example of a barred slanted window)

I am new to modeling 3D objects and spend hours now on figuring out how to create a barred window with a slanted face in a way that the cylinders representing the bars are correctly touching the slant with their top faces.

Let me provide an image:

The top faces of the bars are flat. To me the problem seems to provide two challenges.
a) How do I manage to cut off the top of the bars in the correct angle?
b) How do I fit them exactly into the opening of the window. Even if snapping to surface would work for the slanted parts, how would you resize the length of the bars for their bottom to rest precisly on the lower face of the window? Actually, this question would even be relevant if the window would not be slanted. How do you generally fit some object exactly into a hole of another object?

I am not sure if these problems can be solved in ProBuilder at all. Ultimately, it’s about prototyping and not building complex models. Maybe I need a full-fledged modeling tool like Blender providing tools like shearing. On the other hand, maybe I am just over-engineering, which raises a last question:
c) Would it be good practice to just let the bars overlap/intersect with the window faces as shown in the image? Or are there particular downsides to doing so?

Any help is appreciated! Unfortunately, it’s even hard to search for solutions if you don’t have the background to formulate the problem with the correct terms. :frowning:

I will answer all of these, but you will find the answer to C most important.

"a) How do I manage to cut off the top of the bars in the correct angle?"

Ensure your transform handle is set to ‘pivot’ and your coordinate system to ‘global’.
Open the vertex position window.
Select a vertex on the pillar.
Use a line plane intersect math on paper to compute the vertical deviation of the coordinate the slope and position of the roof. Apply the corrected coordinates.
Time: 30 minutes+

OR

Create a custom editor function which extends probuilder and implements a line-plane intersect on all vertices to make them match the selected plane.
Time: 2 hours of coding, but the operation takes only a few seconds in the future

Sound daunting? That’s because it is. Maybe there’s a better option.

b) How do … object?”

Repeat the process for A every time you move it, or move the bars along the Z axis by an integer multiple of the slope.

Maybe there’s a better way.

“c) Would it be good practice to just let the bars overlap/intersect with the window faces as shown in the image?”

Yes. It will be visually identical to the player.

“Or are there particular downsides to doing so?”

Barely. First off, it is actually slower to render the cut pillars than it would be to render the clipping pillars. Secondly, game development is a very slow process, and the less work you have to do, the better. Lazy is good.

The way modern graphics cards render, a bunch of identical pillars marked static render much faster than a bunch of slightly different pillars cut at different angles.
Once you add static batching, those identical pillars will be rendered as a single mesh, so it is actually in your best interest to reuse the same mesh as much as possible.

Noclip into some of your favorite AAA games. Look carefully at those bookshelves in Skyrim, walls in Cyberpunk, those buildings in Assassin’s Creed. Everyone clips. It’s OK to clip.

There are a few exceptions to this. These are the only situations in which you would not simply clip the pillars.

1. You are creating props with dedicated, high definition textures.
If you are making a mesh to be repeated throughout, which uses a dedicated set of textures for the objects (e.g props, windows, etc.), then you may not want any of the UV map, and thus the texture coordinates, to be wasted on the hidden part of the pillar. In this situation, you would be wise to cut the pillars and mark the cut as a UV seam to make for better textures.

However, you would have to be absolutely insane to try to do this in Probuilder. It’d be like trying to build a 141 story skyscraper with a stone hatchet and a wheelbarrow full of unrefined iron ore.
Blender has a direct face intersect snap option, knife cut, etc. that can perform this operation, and create the UVs, without breaking a sweat.

2. You’re going to 3d print the level.
In this case you may need to cut the pillars correctly depending on your slicer, or question your life choices.

3. You have a crippling addiction to non-manifold geometry.
If you feel an intense dopamine rush upon seeing perfectly cut mathematically sound geometry while noclipping into a wall and you have a great deal of difficulty resisting it.
I get it, I’ve been there. But you have to accept that for your sake, and your family’s sake, you need to move on. It’s OK to clip and you do not have to be ashamed.

Thank you for this great answer!

Nah, who knows. Might as well take a day for me do get it right. I am not particularly math affine and even less affine to affine geometry, I guess. :wink:

Not sure what exactly you mean by that. But like a) it seems to boil down to manual fiddling. I thought maybe there are some hidden features or workarounds to emulate sort of a Resize Snap To. If that tool support is not available, then this might explain why even in tutorials (about ProBuilder but also Unity in general) everyone just seems to get positioning/sizing right by taking a sharp look. I always thought 3D modeling is a very precise craft. Probably I have overestimated the need for precision.

Do you happen to have experience in Blender, Maya or alike? Maybe you know if those tools support more precise positioning and resizing?

Finally, I especially love how you caught my weak spot with part 3 (3. You have a crippling addiction to non-manifold geometry.) But considering your above summation for letting-be, I will try to resist for the sake of making progress and keeping my sanity. :wink: