Hi, I am having a problem where I want to get a parts size relative to a CFrame. It sounds complicated (it might be) but here are some images showing my problem.
Lets say the big part is A, and the small part is B, when B rotates, how would I get the size of A in B’s object space?
After rotated 90 degrees (The faces are an example of what part B sees as the front faces of the two, but B still has it’s front pointed in the same direction as the last image, as shown by the Vectors I drew)
local function GetSizeRelativeToCFrame(partA, partB)
local relativeCFrame = partB.CFrame:ToObjectSpace(partA.CFrame)
local relativeSize = relativeCFrame:VectorToWorldSpace(partA.Size)
return Vector3.new(math.abs(relativeSize.X),math.abs(relativeSize.Y),math.abs(relativeSize.Z))
end
This gets the relative cframe of PartA and PartB then rotates the size by the Cframe.