hey, I’m having a hard time with figuring this out. this is a script to interpolate an instance to the player with points on the bezier curve. my main goal is to:
- get the player’s distance vector
- get a percentage of that for the curve, for example 30% for the right curve
- position the curve points
- start interpolating
and as it scales more and more, it should keep the same percentage and have a constrained curve.
I’m just kind of having a hard time to plan it out and make it simple and not use excessive lines
original script:
local replicated_storage = game:GetService("ReplicatedStorage")
local bezier = require(replicated_storage:WaitForChild("BezierCurve"))
local soulball = script.Parent
local curveMarker = workspace:WaitForChild("Curve")
local curveMarker2 = workspace:WaitForChild("Curve2")
local marker = game:GetService("ServerStorage"):WaitForChild("Marker")
startPos = soulball.Position
endPos = workspace.dood:WaitForChild("HumanoidRootPart").Position
curvePos =
curvePos2 =
for i = 0, 1.01, 0.01 do
local curve = bezier.new(startPos, curvePos, curvePos2, endPos)
local pos = CFrame.new(curve:Calc(i))
task.wait()
soulball.CFrame = soulball.CFrame:Lerp(pos, i)
--print(pos)
--local new_m = m:Clone()
--new_m.Position = curve:Calc(i)
--new_m.Parent = workspace
end
if anyone could help me, please do so! thank you