I can’t increment it, need to be from 0 to 1
No gaps but now it looks like random positioned parts.
This is the best I got
But as you can see, now the problem here is the Vector Z, I don’t know what I need to add to remove that uncomfortable irregularity
This is the current script
local pos = QuadraticBezier(i/steps , origin.Position, curve.Position, goal.Position);
local pointfront = QuadraticBezier((i+1)/steps, origin.Position, curve.Position, goal.Position)
local superfront = QuadraticBezier((i+2)/steps, origin.Position, curve.Position, goal.Position)
local cf = CFrame.lookAt(
(pos + pointfront) / 2,
pointfront
)
local cf2 = CFrame.lookAt(
(pointfront + superfront) / 2,
superfront
)
local magnitude = (pointfront - pos).Magnitude
local bound1 = cf + cf:VectorToWorldSpace(Vector3.new(2, 0, -magnitude/2))
local bound2 = cf2 + cf2:VectorToWorldSpace(Vector3.new(2, 0, magnitude/2))
local boundsMag = GetDistanceOfCFrames(bound1, bound2)
local line = Instance.new("Part", workspace)
line.Anchored = true
line.Size = Vector3.new(4, 1, magnitude)
line.BrickColor = BrickColor.new("Really red")
line.TopSurface = Enum.SurfaceType.Smooth
line.BottomSurface = Enum.SurfaceType.Smooth
line.CFrame = cf - cf:VectorToWorldSpace(
Vector3.new(boundsMag * math.pi, 0, 0.5)
)
I don’t know if anyone alreaady said this but you could try dividing the lookvector so that it doesnt fully move outside of the previous part
I think I solved it using this code
local magnitude = (pointfront - pos).Magnitude
local bound1 = cf + cf:VectorToWorldSpace(Vector3.new(2, 0, -magnitude/2))
local bound2 = cf2 + cf2:VectorToWorldSpace(Vector3.new(2, 0, magnitude/2))
local boundsMag = GetDistanceOfCFrames(bound1, bound2)
magnitude += math.atan(boundsMag) + 0.1 -- This exact line using 'math.atan'.
These small gaps that I left empty are because the parts that make the line are only 10 to make it friendly to poor specs computers.
Anyways, thanks for the help @RunKittenzRComin and @nicemike40
6 Likes