In unity, I am trying to create several curved platforms that connect using bezier curves, however I am having issues. I understand the basics of genertating a bezier curve and I have something working well

My goal is to generate a series of forward moving Bezier curves, that are all connected to each other, while also having varying lengths and points. I have something working, however I am having issues connecting the curves, while retaining random Y values for different heights in the 4 points.

Below is my attempt: issue

Below is a Sketch I did in MS Paint to help explain goal: enter image description here

From the sketch you can see that there is a diffrence in height between gameobject 0 and 1 but they are still connected. How can I generate the next points with random Y values, while still accounting for the previous curve? Any help would be greatly appreciated,

Thank you for your time.

  • \$\begingroup\$ I had a similar setup in a game. What i did was like gameobject1.P0 = gameobject0.P4 and also tangent at gameobject0.p4 = tangent at gameobject1.p0. Tangent of the curve is basically the derivative at that point. I don't have the files with me now but you can give it a shot like this \$\endgroup\$ Feb 8, 2017 at 5:47
  • \$\begingroup\$ Why can't you start the generation of the next chunk at the last point of the previous chunk? \$\endgroup\$
    – jgallant
    Feb 8, 2017 at 11:18
  • \$\begingroup\$ Thank you Nightcrawler23 and jgallant for the help! I was able to figure out the issue but I wanted to say thank you for your time! \$\endgroup\$ Feb 12, 2017 at 15:37

1 Answer 1


Let's start by declaring a few variables:
-p1 is the y value of "Gameobject-0"
-p2 is the y value of "Gameobject-1"
-t1 is the height of the last point on the first curve(Gameobject-0)
-t2 is the height of the first point on the second curve(Gameobject-1)

Having said all this, you should use equation:

p2 = p1 + t1 - t2
  • \$\begingroup\$ JasonPH for the help. I didn't use this equation exactly however it did help me get to my answer. I will post it later. Thank you so much for the help \$\endgroup\$ Feb 12, 2017 at 15:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .