# How can I Creat an continuously extending curve line ?

Sorry,my question were actually not clearly.
I found an Android Game called Speedx 3D.
You can see it here. ( speedx 3D-游戏-高清完整正版视频在线观看-优酷 )
speedx 3D-游戏-高清完整正版视频在线观看-优酷
I’d like to make one which is similar. The tunnel is continuously extending. I suppose it is created by 12 curve line,and then bind something like cubes on it. The curve line changed its position and the tunnel can even become a plane !
Now the problem is that I wonder how to creat the curve line like this in Unity 3D,I don’t know how to write the script……

the way you posted your question is not perfectly clear what you are asking.
Look into splines?

I agree with ivkoni.

Do you mean something like
Y = X^2
or
Y = SQRT(X)

As far as I understand your question, those are infinitely long curves.

Maybe

``````if (x < 0)
{
y = -1 * Mathf.Pow(x,2);
}
else
{
y = Mathf.Sqrt(x);
}
``````

I‘m so sorry I gave an unclear question first

In this thread you will find a library for creating Bezier curves and Catmull-Rom splines, which are two different methods of plotting smooth curves in space. Both curves have a function for getting the “velocity” at a given position. Although the curve velocity does indeed define a speed that is useful for animations, the main use of it is to get the direction of the curve along its length. If you imagine the curve line running down the centre of the tunnel, you can probably see that the tunnel wall panels run in the same direction as the curve. You can use the Mesh class in conjunction with the curve and its velocity to put mesh vertices in positions at a fixed distance from the curve to create the wall panels.

This is not a trivial task but once you have the curve velocity, you can use Vector3.OrthoNormalize to create a coordinate space based around that point (a so-called Frenet Frame). Generally speaking, the coordinates of the wall vertices will be the same values each time, but transformed into the current Frenet Frame’s coordinates. The trick is to fly the camera along the curve and generate several Frenet Frames a short distance ahead of it. Use them to generate the vertices for the mesh and use the Mesh class to create the tunnel geometry from the vertices. Using this technique, you can even generate tunnel sections randomly on the fly and create a literally “endless” tunnel that doesn’t repeat.