I'm really confused about the math of a Quadratic Bezier Curve, could I get some help?

Ok so, I’ve spent ages trying to understand the mathematics of a Quadratic Bezier Curve, but I just cannot grasp it. The only thing I understand is that they are controlled between 3 points. I have no clue how to generate parts and such with the info, nor do I know how to set it all up with functions, args, etc etc.

Could somebody help simplify it as much as possible, and provide an example of a script that utilizes it? Thanks.

The first thing in google when searching “roblox bezier” is literally a roblox-made tutorial on how to make one, with code already given to you!

If you want to model a 3D object using bezier curves, I’d really suggest you just use a 3D modeling software to make a mesh as they would have the curves built in, and not use wasteful instancing of hundreds of parts like modeling it in roblox would.

I’m well aware. I’m trying to understand the math of it.

Sure, it works, but it does a poor job of explaining it (at least from my view, I’m not the best at all this) (also, what is “t”, what does it mean, what does it stand for?!). I want to understand what everything does, not just copy paste some code and input values without having a clue how it works.

As the tutorial says, all the bezier curve does is linear interpolate along a tangent line between the control points. “t” probably stands for “time,” which is the input to the function. As the function says, the time needs to be between 0 and 1, so effectively, you’re just putting in a bunch of times between 0 and 1 and all those resulting points give you the curve. The math is just linearly interpolating along the tangent line of the curve for each timestep, as the images show on the tutorial.

Its just time value, and you can have much more then 3 dots.
Imagine you have start and end and time value which is 0.8, how you gonna calculate pos between them by 0.8?
Thats how:

local timePos = startPos+(endPos-startPos).Unit*0.8

And now lets think what if wee have one pos?

local startPos = Vector2.new(0,0,0)
local endPos = Vector2.new(0,10,0)
local dotPos = Vector2.new(2,5,0)
local t = 0.8
local p1 = startPos+(dotPos-startPos).Unit*t --Pos between start and dot by time
local p2 = dotPos+(endPos-dotPos).Unit*t --Pos between dot and end by time
local calculatedPos = p1+(p2-p1).Unit*t

If you understand how it works you can write function which returns position you need how i did

2 Likes

I sure you will get one strange bug but you will fix it i think…
Also here example how it will looks(made by me)
https://www.roblox.com/games/6970968380/B-zier-curves-showcase