I have been trying to find a math algorythm to align a corner of a part to a rotated part by changing one axis but i cant find it and there are generally not alot of math equations for building tools from what i can find.
As seen in this picture the example is kinda what i want to achive but in the example i can’t really set the Z axis to whatever i want without it not aligning to the blue part.
For this you just have to do some simple CFrame math. Lets say the blue part is called Part1 and the red part is called Part2. You would just get the CFrame of the blue part, and add an offset of half the size of the blue part plus half the size of the red part (so the edges align). You would do so like this: