How is this made?

I have a slight suspicion that bizier curves are involved with this, the over all smoothness of it impresses me and I would like to know how it was done. Any thoughts?

https://gyazo.com/0e1ce27d0d95b83bf19c0d655df30fdd

Bézier curves are used in this case. The particle object is following the path of this curve.

1 Like

Tweening, Trails, ParticleEmitters.

Do you have any tutorials on bezier curves? I’ve tried EgoMoose’s but there quite complicated.

Unfortunately not, it’s almost like another math lesson. Look a little into it.

2 Likes

Bezier curves use three points to calculate a curve
Point 1 - The origin
Point 2 - The Curve Influence
Point 3 - The End Location

There’s more to it but that’s the base concept of it (I usually put the API page at the top of my scripts, use that to see more.)

They can be a pain so I made a function I can use.
Heres what I did at one point to make curves:

--https://developer.roblox.com/en-us/articles/Bezier-curves
-- T is a decimal below 1, 1 means curve is completed
--So smaller intervals means more points and smoother creation
--P1 Is midpoint
--P0 and P2 are the start and finish
--Uses Pythag and current position + %Complete
--V1
function lerp(a,b,c)
	return a + (b - a) * c
end
 
--Lerps All the points
function CurvePoint(p0,p1,p2,t)
	t = t
	--LERP X
	Xl1 = lerp(p0.X, p1.X, t)
	Xl2 = lerp(p1.X, p2.X, t)
	XLerp = lerp(Xl1, Xl2, t)
	--LERP Y
	Yl1 = lerp(p0.Y, p1.Y, t)
	Yl2 = lerp(p1.Y, p2.Y, t)
	YLerp = lerp(Yl1, Yl2, t)
	--LERP Z
	Zl1 = lerp(p0.Z, p1.Z, t)
	Zl2 = lerp(p1.Z, p2.Z, t)
	ZLerp = lerp(Zl1, Zl2, t)
 
	Pos = Vector3.new(XLerp,YLerp,ZLerp)
 
	return Pos
end
 
-- Simplify Curve
-- T should usually be 0
function CreateCurve(p0,p1,p2,t,Inc)
	Points = {}
	t = t
	LoopCount = 0
	while t < 0.99 do
		CurvePoint(p0,p1,p2,t)	
		Points[LoopCount] = CurvePoint(p0,p1,p2,t)	
		--Keeps Track Of Progress
		LoopCount = LoopCount + 1
		t = LoopCount * Inc
	end
	return Points
end
4 Likes

https://developer.roblox.com/en-us/articles/Bezier-curves

This is a tutorial, but like you said, if someone want to understand this really you need to understand the base of the math used here.

3 Likes

I agree, enjoy the migraines caused by this messy API :wink:

There will be more information out there aside from the API like educational sites used for A level mathematics.

2 Likes

What does Inc represent? I was thinking it was how much the points are spaced out by but I’m not sure.

edit: nvm thank you so much you explained that better for me in 50 lines then EgoMoose did in 500.