Negate smaller part from bigger part? (No unioning)

To specify the title a bit more, I want a 4x4x4 simple block to be negated from a bigger block of any size. This 4x4x4 block can be in any position. This will require me to divide the big block that’s being negated one to several times because I don’t want to use in-game unioning. I assume this will require some calculating as well about how many times to split the big block and where.

I just don’t know the mathematics behind dividing a part to simulate a hole being created in the block. I’ve tried making many searches but couldn’t find anything relating to this. If anyone has any references or solutions I can look up to it’d be much appreciated.

An example of a random place to negate from

2 Likes

Have you seen this?
Edit: I see you don’t want to use in-game unioning. Why is this?

Why do you not want to use in-game unioning?
It does exactly what you want and doesn’t introduce any extra polygons (than what you’d expect) if you ensure all blocks have the same orientation. (You can check the Tri Count before and after as proof.) Overall, this will have less tri count than the tri count of the combined part-by-part negation.

I’m using a delete tool which deletes chunks of the big block. When I actually create a hole by unioning though, there are a lot of bugs that arise (such as odd mouse hit behavior). Even if I put my mouse in the hole, it’ll still behave like the entire block is still there despite there being a hole.

This is why I want the big block to subdivide itself into multiple blocks when creating holes. Extra polygons doesn’t really matter to me either.

You could look into representing each blocks in code as tensors with values representative of 1x1x1 studs, and then use vector math to subtract the part you want to delete from the main part’s tensor, and then use the new tensor values to generate a new set of parts.
However, this would require a decent amount of mathematical knowledge concerning vector algebra and tensors, and possibly even matrices if you want to solve the simultaneous equations needed efficiently.

1 Like