Bending a tube via a script

Im trying to create a warp tunnel , bending kind of effect using the script from the procedual generation example.
The reason im using a script is i need it to be random and what not.

The problem is that only the central verticies of the model move upwards creating a werid pinching effect , which hopefully can be seeen in this image:

This is the code, im using a tan curve to bend the verticies which seems to work quite well.

Heres the code:
var Bend = 0.0;

var inputSensitivity = 0.1;

private var baseVertices : Vector3;

private var baseNormals : Vector3;

function Update ()

{

Bend += Input.GetAxis("Horizontal") * inputSensitivity * Time.deltaTime;

var mesh : Mesh = GetComponent(MeshFilter).mesh;

if (baseVertices == null)
	baseVertices = mesh.vertices;
if (baseNormals == null)
	baseNormals = mesh.normals;
	
var vertices = new Vector3[baseVertices.Length];
var normals = new Vector3[baseVertices.Length];

for (var i=0; i < vertices.Length; i++)
{
	vertices <em>= DoTwist(baseVertices<em>, baseVertices_.z * Bend);_</em></em>

normals = DoTwist(baseNormals, baseVertices_.z * Bend);
* }*_

* mesh.vertices = vertices;*
* mesh.normals = normals;*

* mesh.RecalculateNormals();*
* mesh.RecalculateBounds();*
}
function DoTwist( pos : Vector3, t : float )
{
* var tt = Mathf.Tan(t);*

* new_pos = Vector3.zero;*

* new_pos.x = pos.x;*

* new_pos.z = pos.z;*

new_pos.y = pos.y + pos.ytt * pos.ytt;
* return new_pos;*

}
So, what must i do to get the tube to bend upwards , retaining its cylindrical
Any help would be greatly appreciated, thank you.

Any Y values near zero aren’t going to move if you’re adding pos.yttpos.ytt. I think you want to just add tttt ?? You may also want to consider keeping an ‘original copy’ of the tube and modifying that to produce the bent tube. Turn the renderer off for the original.