Getting the part's largest size axis relative to the part's orientation

Hello, I’m trying to get the part’s largest size axis relative to the part’s orientation, an example of what I’m trying to say:

  • Part 1’s Orientation is 0, 0, 0, and it’s size Y size is 10, while X and Z are 4.
  • Part 2’s Orientation is 0, 0, -90, and it’s size X size is 10, while Y and Z are 4.
    I need to get the 10 size axis (number itself doesn’t matter as long as it’s bigger than the other 2 axis) with a script,

I’m not sure how to even approach making something like this so any help will be appreciated.

You could try looking at the objects UpVector, LookVector and RightVector properties of its CFrame.
https://create.roblox.com/docs/reference/engine/datatypes/CFrame

I solved this problem after a while, I forgot what post I managed to get the function code from but I’ll leave this here for anyone who comes across this problem

local function GetWorldSize(part)
	local size = part.CFrame:VectorToWorldSpace(part.Size)
	return Vector3.new(math.abs(size.X), math.abs(size.Y), math.abs(size.Z))
end
3 Likes