Unfortunately, Zomebody is out of town for two weeks, and I am sure Wsly and he want to keep the official code under wraps. I can give you a short snipped of the code I use to generate the path. This generation is nothing like the official code: I use bezier curves projected between distances of 100 to 250, whereas Zome’s generation deals in short, discreet segments each time. Still, if you are interested in random generation, it’s an interesting look-see.
for i = 1,numOfSegments do
if i%3 == 0 then
LeftOrRight = math.random()<0.5 and 1 or -1
end
if i%7 == 0 then
wait()
end
if i%2 == 0 then
UpOrDown = math.random()
end
local segmentLength = math.random(minsegmentLength,maxsegmentLength)
if i == numOfSegments then
segmentlength = maxsegmentLength
end
local start = controlpoints[i-1].cf
controlpoints[i-1].ha = math.random(defaultHandleLength-segmentLength/5,defaultHandleLength+segmentLength/5)
local halfway =start*CFrame.new(0,0,-segmentLength/2)
halfway = CFrame.new(halfway.p,
(halfway*CFrame.new(0,0,-1).p)
+Vector3.new(0,halfway.y-(halfway*CFrame.new(0,0,-1)).y)
)
local maxup = -math.pi/16
local maxdown = -math.pi/16*UpOrDown+maxup
local angleofelevation = math.random()*(maxup-maxdown)+maxdown
local rotate = math.random()*0.75*(50/segmentLength)*math.pi*LeftOrRight
local offset = Vector3.new(0,0,-segmentLength/2)+Vector3.new(math.random(-15,15),math.random(-5,5),math.random(-15,15))
ending = halfway*CFrame.Angles(0,rotate,0)*CFrame.Angles(angleofelevation,0,0)*CFrame.new(offset)
controlpoints[i]={cf=ending,hb=math.random(defaultHandleLength-segmentLength/5,defaultHandleLength+segmentLength/5),ha = 0}
local startVector = ending.lookVector
local endVector = (start*CFrame.Angles(0,math.pi,0)).lookVector
local totalAngle = math.acos(startVector:Dot(endVector))/math.pi
points, segmentoffset,curvelength,model = bezier.CreateCubicCurve(
controlpoints[i-1].cf.p,
(controlpoints[i-1].cf*CFrame.new(0,0,-controlpoints[i-1].ha)).p,
(controlpoints[i].cf*CFrame.new(0,0,controlpoints[i].hb)).p,
controlpoints[i].cf.p,
totalAngle*50,
segmentoffset,
_,_,_,
true
)
for j = 1,#points do
table.insert(CFrameTable,points[j])
--table.insert(PartsTable,model[j])
end
totalDistance = totalDistance+curvelength
if controlpoints[i].cf.y < minheight then
break
end
if model then
model.Parent = CaveModel
for _,k in pairs (model:GetChildren()) do
if k:IsA("BasePart") then
k.BrickColor = BrickColor.Black()
end
end
end
end