Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to cut a brick on angle?

I saw THIS older post, it works fine but I'm wondering how to cut it in a different direction? right now it cuts straight down but I'm wondering how to could make it do an angled cut? like, cut from one corner to the other? I got it working U/D and L/R but could not figure corner for the life of me!

Code:

function CutPart(orig, typ)
	if typ == "STR" then -- STR = STRaight
	    local extentsX,extentsZ,extentsY = orig.Size.X/2,orig.Size.Y,orig.Size.Z;
	    local pos = orig.CFrame;
	    for i = 1,2 do 
	        local new = orig:Clone();
	        new.Size = Vector3.new(extentsX,extentsY,extentsZ);
	        local x = (i == 1 and -extentsX/2) or extentsX/2;
	        local newPos = pos * CFrame.new(x,0,0);
	        new.CFrame = newPos;
	        new.Parent = orig.Parent;
	    end
		orig.Transparency = .7
	elseif typ == "LTR" then -- LTR = Left To Right
	    local extentsX,extentsZ,extentsY = orig.Size.X/2,orig.Size.Y/2,orig.Size.Z
	    local pos = orig.CFrame
	    for i = 1,2 do
	        local new = orig:Clone()
			local x = (i == 1 and -extentsX/2) or extentsX/2
			local z = (i == 1 and extentsZ/2) or extentsZ/2
	        new.Size = Vector3.new(extentsX,extentsY,extentsZ)
	        local newPos = pos * CFrame.new(x,0,z)
	        new.CFrame = newPos
	        new.Parent = orig.Parent
	    end
		orig.Transparency = .7
	elseif typ == "ANG" then -- ANG = ANGle -- note this is just LTR copy and pasted as i did not know how to do it and all my other attempts made it worse
	    local extentsX,extentsZ,extentsY = orig.Size.X/2,orig.Size.Y/2,orig.Size.Z
	    local pos = orig.CFrame
	    for i = 1,2 do
	        local new = orig:Clone()
			local x = (i == 1 and -extentsX/2) or extentsX/2
			local z = (i == 1 and extentsZ/2) or extentsZ/2
	        new.Size = Vector3.new(extentsX,extentsY,extentsZ)
	        local newPos = pos * CFrame.new(x,0,z)
	        new.CFrame = newPos
	        new.Parent = orig.Parent
	    end
		orig.Transparency = .7
	end
end


local p = Instance.new("Part",workspace)
p.Size = Vector3.new(5,5,5)
p.CFrame = CFrame.new(0,10,0) * CFrame.Angles(45, 0, 45);
p.Anchored = true

wait()

CutPart(p, "STR")

local p2 = Instance.new("Part",workspace)
p2.Size = Vector3.new(5,5,5)
p2.CFrame = CFrame.new(0,20,0) * CFrame.Angles(45, 0, 45);
p2.Anchored = true;
wait()

CutPart(p2, "LTR")

local p3 = Instance.new("Part",workspace)
p3.Size = Vector3.new(5,5,5)
p3.CFrame = CFrame.new(0,30,0) * CFrame.Angles(45, 0, 45);
p3.Anchored = true;
wait()

CutPart(p3, "ANG")

and HERE is a picture idk if it helps or not

1 comment

0

anything?

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.