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

How to do a beam that moves in different directions?

Asked by 7 years ago

Found 1 interesting game and many months ago and found something very interesting, he made a beam that can move randomly : https://gyazo.com/9eafa30aa605f6301e8713bcb7054cfa

At the time I was a little bad at programming, now I want to know how I can make a similar one.

I do not want a script, just instructions or what he did to create this, I believe he used Bezier curves

0
Don't go from little experience to coding stuff like this. It's better to work slowly and reach to the top, so you actually understand what this is when you're scripting it. GroovyII 4 — 7y
1
I have to disagree with Groovyll here in general -- working on something you don't fully understand is the first step to understanding it. In any case, it seems like OP isn't very new anymore. I would guess he generates four control points for a 5th(?)-degree bezier curve. One at each end, and two in the middle offset by some random amount. Interpolate from t=0 to t=1 and voila. nicemike40 486 — 7y

1 answer

Log in to vote
1
Answered by 7 years ago
Edited 7 years ago

My personal guess:

I would say he generated 1-2 random points within the radius of the player, then used Bezier curves to fill in the blanks.

Worth noting; doing Bezier curves is actually really easy. Waffle taught me this:

local p1 = pos
local p2 = pos
local p3 = pos

for i = 1, 20 do
    local part = Instance.new("Part")
    part.Size = Vector3.new(1,1,1)
    part.Shape = "Ball"
    part.Anchored = true
    part.CanCollide = false

    local x = i/20
    part.CFrame = CFrame.new(p1:lerp(p3, x):lerp(p3:lerp(p2, x), x))

    part.Parent = workspace

    wait(.2)
end

In case I didn't do that right here's what Waffle said.

0
Thank you for helping me, now I have more notion about what to do, this will help me a lot in the future. Rodrigo2003 76 — 7y
0
https://gyazo.com/38ab5be63d90db7132d6f641bc746837 , its not perfect but looks cool ^-^ Rodrigo2003 76 — 7y
0
<3 OldPalHappy 1477 — 7y
Ad

Answer this question