- You will need use right triangle image.
- IDK if this will be helpfull to you, but I experimented with mesh cutting in 3D space, and I have found this Triangle creation function. It will calculate CFrame and SIze of both Wedges.
local function CalculateTriangle(a,b,c)
local ax,ay,az=a.x,a.y,a.z
local bx,by,bz=b.x,b.y,b.z
local cx,cy,cz=c.x,c.y,c.z
local px,py,pz=ax,ay,az
local tx,ty,tz=cx,cy,cz
local v0x,v0y,v0z=bx-ax,by-ay,bz-az
local v1x,v1y,v1z=cx-ax,cy-ay,cz-az
local d01=v0x*v1x+v0y*v1y+v0z*v1z--In case of case 2 triangle. Speeds it up a lot
local d=d01/(v0x*v0x+v0y*v0y+v0z*v0z)
if d>0 then
if d>1 then--Case 2 triangle
tx,ty,tz=bx,by,bz
v0x,v0y,v0z,v1x,v1y,v1z=v1x,v1y,v1z,v0x,v0y,v0z
d=d01/(v0x*v0x+v0y*v0y+v0z*v0z)
-- else Case 1 triangle
end
else--Case 3 triangle. Don't get a case 3 triangle lol. Slowest of them all.
px,py,pz=cx,cy,cz
tx,ty,tz=ax,ay,az
v0x,v0y,v0z=bx-cx,by-cy,bz-cz
v1x,v1y,v1z=-v1x,-v1y,-v1z
d=(v0x*v1x+v0y*v1y+v0z*v1z)/(v0x*v0x+v0y*v0y+v0z*v0z)
end
local y0x,y0y,y0z=tx-px-d*v0x,ty-py-d*v0y,tz-pz-d*v0z
local l0,l1=(v0x*v0x+v0y*v0y+v0z*v0z)^0.5, (y0x*y0x+y0y*y0y+y0z*y0z)^0.5
local hy0x,hy0y,hy0z,hd=y0x*0.5,y0y*0.5,y0z*0.5,d*0.5
local tf=0.5+hd
local oyx,oyy,oyz,ozx,ozy,ozz=y0x/l1,y0y/l1,y0z/l1,v0x/l0,v0y/l0,v0z/l0
local oxx,oxy,oxz=oyy*ozz-oyz*ozy,oyz*ozx-oyx*ozz,oyx*ozy-oyy*ozx
local Tris1CF = CFrame.new(v0x*hd+hy0x+px,v0y*hd+hy0y+py,v0z*hd+hy0z+pz, oxx,oyx,ozx,oxy,oyy,ozy,oxz,oyz,ozz)
local Tris2CF = CFrame.new(v0x*tf+hy0x+px,v0y*tf+hy0y+py,v0z*tf+hy0z+pz,-oxx,oyx,-ozx,-oxy,oyy,-ozy,-oxz,oyz,-ozz)
local Size1 = Vector3.new(0.001,l1,d*l0)
local Size2 = Vector3.new(0.001,l1,(1-d)*l0)
return Tris1CF, Size1, Tris2CF, Size2
end
If you understand anything here, you need to convert this into 2D from 3D
(Need to mention that this part of script isn’t mine, and due to fact that I found this piece of code 1 year ago, I don’t remember it’s creator)