Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function TraceLine(Start, End, Offset_Min, Offset_Max, NUM_PARTS, SIZE_VARIES)
- local Points = {Start}
- local Magnitude = (End-Start).magnitude
- local Space = 0
- local Z_Range = (type(NUM_PARTS) == "number" and NUM_PARTS > 0) and math.modf(NUM_PARTS) or math.random(4,8)
- local Point,X,Y,Z;
- local Offset_Min = Vector2.new(math.modf(Offset_Min.X),math.modf(Offset_Min.Y))
- local Offset_Max = Vector2.new(math.modf(Offset_Max.X),math.modf(Offset_Max.Y))
- --pretty readable so u should know wut this does i guess
- if type(NUM_PARTS) == "number" and NUM_PARTS > 0 then
- local n = 0;
- local delMag = Magnitude;
- while n < NUM_PARTS - 1 do
- X = math.random(Offset_Min.X,Offset_Max.X)
- Y = math.random(Offset_Min.Y,Offset_Max.Y)
- if SIZE_VARIES then
- Z = delMag/(NUM_PARTS-n)*100
- Z = math.random(Z/1.5, Z)/10
- else
- Z = Magnitude/NUM_PARTS
- end
- Point = CFrame.new(Start,End) * CFrame.new(X, Y, -(Space + Z))
- table.insert(Points,Point.p)
- Space = Space + Z
- delMag = delMag - Z
- n = n+1;
- end
- else
- while Space < Magnitude - Z_Range do
- X = math.random(Offset_Min.X,Offset_Max.X)
- Y = math.random(Offset_Min.Y,Offset_Max.Y)
- Z = math.random(Z_Range/2, Z_Range)
- Point = CFrame.new(Start,End) * CFrame.new(X, Y, -(Space + Z))
- table.insert(Points,Point.p)
- Space = Space + Z
- end
- end
- table.insert(Points,End)
- return Points
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement