[Math Hard] Beziercurves, I need an explanation about this function

Hey!

Hey! look the Dev Hub is seriously amazing in some cases, but when it comes to the step learning over the time then the Dev Hub loses in my eyes.

So I understood everything to the Beziercurve even the post in Wikepedia, and even the math behind it!:

But when it comes to create a function with Beziercurve and try to create with it something I am soo knocked over.

So this is the DevHub where I learnd the things:

and everything what you can see in the DevHub I learnd (even the functions), untill it comes to this:

I seriously dont understand anything here. I mean maybe some variables but when it comes to the math I cant understand in this whole functions.

I can understand why the guy wrote for t = 0, 1, 0.01 do… but seriously not much more

NOTICE!: You can give me some examples why here it is similar to what I have been understood above - look in the Devforum and the picture I sended here.

So how can you nice guy - which understood everything - help me?

  1. Explain step to step everyhthing.
  2. When you explain something then check if somoene in class 6 can understand what you wrote.
  3. Explain also the functions. Why wrote he a update function and a travelcurve function?

Please make sure if you understood everything before explaining me something that you even dont know.

Thanks again for any help, and I dont expect an explanation about such a big thing.

I dont expect the best explanation

The example they use for the bezier curve is the parametric representation of it thats why it looks stupid. Basically parametric equations describe you have this value (usually a vector3) which you then multiply by to figure out the position of it. For example the parametric equation of a line is o+(d*t) where o is a point on the line and d is the direction of it and t is how far to go along it in a sense. Beziers are pretty much the same except quadraticy. I made a video on this and theres like code examples in the video too.

I understood that like I said. I need an explanation for the function itself. Just explain the function step for step.

but thanks for ur help!

Okey let me show you what I mean.


f.Size = Udim2.new(0,v.magnitude + 1, 0, 2)
what you can see here is… as you saw above we took…

for every step in the function. The problem in DevHub is: They explain step to step and then they give something really different to what I have been learnd (best example 3 functions with different tasks, no explanation about anything in the function). Its not fair, let the people learn step to step and not give them such a hard function after explanaining it step to step

One of the reasons why I didn’t initially get into developing in 2018 was because I read that exact same article and it didn’t make any sense at all.

I am pretty sure you will never need to use Bezier curves in your game because I have never used them but they are pretty cool.

To start, you will need to understand lerping. Here is a video you can watch by TheDevKing that will help you:

This will help you understand the code a little bit more. I recommend you get used to lerping before you start learning about Bezier curves.

Again, hahaha thanks! But I understood lerp. I just dont understand the task of the 3 functions and also I cant understand what really f.Position and f Rotation do. Just give me an explanation about the whole 3 functions I seriously dont want more.

Again look at Wikepedia and the DevHub!

As I said: I understood everything in the Wikepedia-forum and also the DevHub untill it comes to “Arc-lenght parameterization” with the 3 functions.

I am not rude. Again thanks for your help, but could you guys stop sending me lerps and an explanation about the Beziercurve?

My question again:

What does the function do?
Can you visualize me how it work with the drawline?
Give me some examples.

**

> seriously dont send me an explanation about the lerp or the beziercurve itself I understand it!

**
Again the function…the fuuuunction??? I am sorry but I hope you guys know what I mean with function?

if you still dont know here:

1. function drawLine(p1, p2) --- this make dooooos
2. local v = (p2 - p1) -- this make thiiiiissss
3. local f = Instance.new("Frame") -- this make theooooos
4. f.Size = UDim2.new(0, v.magnitude + 1, 0, 2) -- this make this
5. f.Position = UDim2.new(0,(p1.x + v.x/2) - f.Size.X.Offset * 0.5, 0, (p1.y + v.y/2) - f.Size.Y.Offset * 0.5) -- this make aaaaaa
6. f.Rotation = math.deg(math.atan2(v.y, v.x))
7. f.BorderSizePixel = 0
8. f.BackgroundColor3 = Color3.new()
9. return f
10. end
* function update(p0, p1, p2, p3, canvas)
11. local last
12. canvas:ClearAllChildren() -- clear any previous drawings
13. for t = 0, 1, 0.01 do -- 0 <= t <= 1
14. local p = cubicBezier(t, p0, p1, p2, p3)
15. if last then drawLine(last, p).Parent = canvas end
16. last = p
17. end
18. end
* function travelCurve(p0, p1, p2, p3, moving)
19. for t = 0, 1, 0.01 do -- 0 <= t <= 1
20. local p = cubicBezier(t, p0, p1, p2, p3)
21. moving.Position = UDim2.new(0, p.x - mp.AbsoluteSize.x/2, 0, p.y - mp.AbsoluteSize.y/2)
22. game:GetService("RunService").RenderStepped:wait()
23. end
24. end

Bezier curves are known as approximate cruves, they dont directly use interpolation but rather but bezier curves work by drawing a point dependent on the alpha. So like if we at 0.5 it will be half way across both in the middle and if we at 0.2 it will be somewhere in the bottom left corner assuming they form a triangle. Here is a drawing I made of what I mean if it helps

1 Like