Produce a part that occupies the same space as another part but with 0,0,0 orientation

What do you want to achieve?
Suppose there’s a Part named Part1. The size is (5, 3, 6) and the orientation is (0, 90, 0). Now, there’s a second part named Part2 that occupies the same exact space as Part1, except the size is (6, 3, 5) and the orientation is (0, 0, 0). I want to produce Part2, given any Part1 of varying size. Part1’s orientation components will always be divisible by 90 and Part2’s orientation should always be (0, 0, 0). How do I do this?

What is the issue?
I’m unsure of how to solve this problem. I don’t have the mathematical competence to figure it out for myself, and I’m not really sure how to search the internet for this problem either. Just to be clear, I’m not asking for someone to write a script for me. I’m just hoping to find some insight on this particular issue since I don’t really know where to start.

What solutions have you tried so far?
I’ve tried a hacky and cumbersome solution where I use Model:GetBoundingBox() but it’s not ideal for my purpose.

Visual demo: (red is input, blue is output)
image

Any help’s appreciated!

I used GetBoundingBox() too. It hasn’t broken yet and I don’t think it’s that bad if you are just doing simple calculations.

2 Likes

For my use, it’s gonna be running at whatever the client’s framerate is in RenderStepped. Do you think there’s any major performance implications doing it that way?