Getting Part Corners


#1

I’m trying to get 4 corners on a part ignoring the X axis however because I’m dividing the size by 2 to get the corners its also dividing the rotation by 2 making the results inaccurate on rotated parts. How would I fix this?

local function GetPartCorners(Part)
	local Size = Part.Size
	return {
		CFrame.new(0, -Size.Y / 2, -Size.Z / 2) * Part.CFrame,
		CFrame.new(0, -Size.Y / 2, Size.Z / 2) * Part.CFrame,
		CFrame.new(0, Size.Y / 2, -Size.Z / 2) * Part.CFrame,
		CFrame.new(0, Size.Y / 2, Size.Z / 2) * Part.CFrame,
	}
end

#2

You need to flip your CFrames around. CFrames can be likened to a Position + Angle, and when you multiply CFrames, you offset the 2nd CFrame by the 1st, so if the Angle is not zero, you won’t end up with the same thing when you multiply a * b as b * a.


#3

Thanks! As you can tell I’m not a expert on CFrame.