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

Trying to make a JJBA Barrage Effect using Bezier Curves?

Asked by 2 years ago

So basically i am trying to make a function where i fire a remote then a Arm appears then curves around the player

local TS = game:GetService("TweenService")
        local rarm = game.ServerStorage.arm:Clone()
        rarm.Parent = workspace.BarrageEffects
        local root = player.Character.HumanoidRootPart
        rarm.CFrame = root.CFrame + -root.CFrame.LookVector*2 + root.CFrame.UpVector*2 + -root.CFrame.RightVector*4
        rarm.Orientation = Vector3.new(22.52, -135.9, -69.64)
        rarm:ClearAllChildren()
        rarm.Anchored = true
        function lerp(a, b, c)
            return a + (b - a) * c
        end
        function quadBezier(t, p0, p1, p2)
            local l1 = lerp(p0, p1, t)
            local l2 = lerp(p1, p2, t)
            local quad = lerp(l1, l2, t)
            return quad
        end

        local p0 = root.Position + -root.CFrame.LookVector*2 + root.CFrame.UpVector*2 + root.CFrame.RightVector*4
        local p1 = root.Position + root.CFrame.LookVector*4 + root.CFrame.RightVector*7
        local p2 = root.Position + root.CFrame.LookVector*10 + -root.CFrame.UpVector*2 + root.CFrame.RightVector*.3

        spawn(function()
            for t = 0,1,.08 do
                local curve = quadBezier(t,p0,p1,p2)
                rarm.CFrame = CFrame.new(curve)
                game:GetService("RunService").Heartbeat:Wait()
            end;
        end)
        game.Debris:AddItem(rarm,1)

this is what i have and it works but idk how to make it rotate as well please help me

1 answer

Log in to vote
0
Answered by 2 years ago

At line 26, rewrite the sentence to rarm.CFrame = CFrame.new(curve) * CFrame.Angles(math.rad(90),0,0) and that'll do it

Ad

Answer this question