Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Part isn't moving along the bezier curve?

Asked by 5 years ago

I tried moving a part along a bezier curve, which is unanchored and the cancollide property is false. The problem is that when I press play the part just simply destroys itself as the test begins instead of moving. Here is the code:

local part0 = script.Parent
local part1 = script.Parent.Parent:WaitForChild("Bez1")
local part2 = script.Parent.Parent:WaitForChild("Bez2")


local function LerpBez(start, finish, per)
    start:Lerp(finish, per)
    print(tostring(start))
end

local function LerpCreate(start, finish, otherfinish, per)
    local l1 = LerpBez(start, finish, per)
    local l2 = LerpBez(finish, otherfinish, per)
    local bez = LerpBez(l1, l2, per)
    return bez
end


for i = 0, 1, 0.05 do
    local positions = LerpCreate(part0.Position, part1.Position, part2.Position, i)
    part0.Position = Vector3.new(positions)
    print(tostring(positions))
    wait()
end
0
If you are not anchoring the part for the duration of movement, you are doing it wrong. Disabling collisions is also helpful. sleazel 1287 — 5y

Answer this question