How would i get parts size depending on its rotation?

i dont really know how to explain my issue so here is a drawing:


Basically if the part is rotated by 90 degrees, i want it to return the second size

2 Likes

Can you guarantee that the rotations will always be multiples of 90 degrees on the X, Y, or Z axis?

For instance, if the part is rotated 45 degrees, what do you want the result to be? Or do you not care in that case?

im working on a placement system, you can only rotate by 90 degrees.

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

-- for example
local sizeInWorldSpace = GetWorldSize(workspace.Part)

Should work for this

Edit a year later: The above function only works if your part is rotated in 90-degree increments. For a version which works at arbitrary rotations at the cost of some speed, see this post.

18 Likes

yea that works. Thanks for the help!

1 Like

For some reason the output is being the same, no matter how I rotate the part.


This is the same script as yours I believe.