Terrain generator rotation

Hi there

I’ve got a piece terrain generator from my university, and it all works fine, creating the terrain as instructed (which consists of 3 planes, one for the floor, 2 for the calls). The problem I’m having however is that the generator only activates when I run through a wall, causing the player to fall endlessly. I was wondering if anyone would have any advice on how I can either rotate where the terrain generates so that instead of running through the wall, they run ahead, or if it could be altered so that instead of running through the wall to generate it, the player could run forward and it generates. The following code is for the generator and the trigger:

generator:

using UnityEngine;
using System.Collections;

public class TerrainGenerator : MonoBehaviour {

public GameObject boxPrefab;
public int numOfPieces = 10;

GameObject[] goPool;

// Use this for initialization
void Start () {

	FillArray();
}

void FillArray()
{
	goPool = new GameObject[numOfPieces];
	Vector3 pos = Vector3.zero;
	for(int i=0;i<numOfPieces;i++)
	{
		goPool *= (GameObject) Instantiate(boxPrefab,pos,Quaternion.identity);*
  •   	pos.x += -10.0f;*
    
  •   }*
    
  • }*
  • public void UpdateRoad()*
  • {*
  •   GameObject[] temp = new GameObject[numOfPieces];*
    
  •   for(int i=0;i<numOfPieces;i++)*
    
  •   {*
    
  •   	if(i!=numOfPieces-1)*
    
  •   	{*
    

_ temp = goPool[i+1];_
* }*
* else*
* {*
_ temp = goPool[0];
temp*.transform.position = temp[i-1].transform.position + new Vector3(90.0f, 0.0f, 0.0f);
}
}
goPool = temp;
}
}
box trigger:
using UnityEngine;
using System.Collections;
public class BoxTrigger : MonoBehaviour {
TerrainGenerator spawn;
// Use this for initialization*

* void Start () {
spawn = GameObject.Find(“TerrainGenerator”).GetComponent();
}
void OnTriggerEnter(Collider other)
{
if(other.tag == “Player”)
spawn.UpdateRoad();
}
}*

Any help with this would be greatly appreciated!
Thanks._

did u put a collider to the terrain AND play with the is trigger box if u did