Making rotated Region3's

I have a part that is a reference for the region in question and since it is rotated the region ends up just being a diagonal line. How can I make it cover the reference part?

--Scan structures--
for _,v in pairs(regionPart:GetChildren()) do
	local newMin = v.CFrame:ToWorldSpace(CFrame.new(-(v.Size/2))) --Minimum value
	local newMax = v.CFrame:ToWorldSpace(CFrame.new(v.Size/2)) --Max value
	local structureRegion = Region3.new(newMin.p,newMax.p)
	v.CFrame = structureRegion.CFrame --Visualize the Region
	v.Size = structureRegion.Size
	v.Transparency = 0
	for _,v in pairs(workspace:FindPartsInRegion3WithWhiteList(structureRegion,{new})) do
		print("Found")
		found = false
		break
	end
end

You can use this module

3 Likes

Have you read the DevHub API reference for Region3?

If I understand correctly, it clearly says Region3 has CFrame which can be rotated.

2 Likes

You can’t actually change the CFrame so the rotation makes it always aligned with the world axis.

3 Likes

Yea, you can’t modify it’s CFrame like that.

I have an idea but I am not sure it will work.

You can use the rotated region3 module sent by @B_arocena. It’s really helpful unless you want to code it yourself.

I might do that, may help to look at the code to try and understand

I have tried that, it gives me errors despite me using it correctly