Can't find corners on a part

So, I was developing a plugin that needs the corners of the part but I’ve struggled with strategies, I looked at many posts in the dev forum but 1 didn’t work, for the other one, I couldn’t find a way to match together my knowledge and so on. Here’s my script from the first post I tried(not full script):

	print("Relased plugin mouse.")
	if mouse.Target.ClassName == "Part" or "BasePart" or "UnionOperation" or "NegateOperation" then
		print("Target is on point.")
		local Corner1 = mouse.Target.CFrame:PointToWorldSpace(
		print("Set corner 1.")
		corners[1].Position = Corner1
		corners[1].Parent = workspace
		local Corner2 = mouse.Target.CFrame:PointToWorldSpace(
		print("Set corner 2.")
		corners[2].Position = Corner2
		corners[2].Parent = workspace
		local Corner3 = mouse.Target.CFrame:PointToWorldSpace(
		print("Set corner 3.")
		corners[3].Position = Corner3
		corners[3].Parent = workspace
		local Corner4 = mouse.Target.CFrame:PointToWorldSpace(
				print("Set corner 4.")
		corners[4].Position = Corner4
		corners[4].Parent = workspace

Expected Behaviour:

Actual Behaviour:


You’re over complicating this. You can get the position of each corner with (t = Mouse.Target)

c1 = + t.Size.X/2, t.Position.Y, t.Position.Z + t.Size.Z/2)
c2 = - t.Size.X/2, t.Position.Y, t.Position.Z + t.Size.Z/2)
c3 = - t.Size.X/2, t.Position.Y, t.Position.Z - t.Size.Z/2)
c4 = + t.Size.X/2, t.Position.Y, t.Position.Z - t.Size.Z/2)

The corners of a part is its size divided by two in both the negative and positive axis.

local corner =, part.Size.Y, part.Size.Z/2)

This is only one of the corner, iterate between the positive and negative of X and Z.

So I just set the position of for example part 1 in the script to c1?

That is only the top right corner of the part, I do not know what you wish to do with the corners.

My bad, this obviously won’t work on rotated parts, which was an oversight on my part. You’ll need to use cframes to offset with a rotation as well:
(t.CFrame *, 0, t.Size.Z/2)).Position this for example will get you one corner, then it’s the same as the others where you flip the signs until you have all 4 corners you want ++, +-, --, -+

I’m a little confused here, where do I put the symbols?

Well you only need the negative symbol, +x -z is a different corner than +x +z and -x +z and -x -z. Basically you make every combination of positives and negatives to get each corner, which when not including y is 4.

(t.CFrame *, 0, t.Size.Z/2)).Position -- + +
(t.CFrame *, 0, t.Size.Z/2)).Position -- - +
(t.CFrame *, 0, -t.Size.Z/2)).Position -- - -
(t.CFrame *, 0, -t.Size.Z/2)).Position -- + -

My question was where do you put the symbols?

Yes and I told you where… at x and z, but not all symbols are the same one of them is positive positive, one is positive negative, one is negative negative and one is negative positive.

1 Like

They’ve already added the + and - in each of the 4 lines using the t and -t values.
The ± symbols at the end are just a reference to which line is which.

It’s only 1 time use, it works but it’s only 1 time use.

Thanks for telling me that, I was blind enough not to see.