The mesh isn’t changing at all. I am trying to move up the vertices as this gameobject that this script is attached to moves through those vertices but it seems not to be recalculating the normals or bounderies. Also maybe this is due to the “ground” mesh being a model imported from blender.
public float speed = 50;
private GameObject ground;
private Mesh groundMesh;
private Vector3[] groundVertices;
private Vector3[] origGroundVertices;
// Use this for initialization
void Start () {
ground = GameObject.FindGameObjectWithTag ("Ground");
groundMesh = ground.GetComponent<MeshFilter> ().mesh;
groundVertices = groundMesh.vertices;
origGroundVertices = groundVertices;
base.GetComponent<Rigidbody>().velocity = new Vector3(0,0,speed);
}
// Update is called once per frame
void Update () {
//transform.Translate (Vector3.forward * Time.deltaTime * speed);
for (int i = 0; i<groundVertices.Length;i++){
if(base.GetComponent<Collider>().bounds.Contains(groundVertices*)){*
groundVertices .y += 100f*Time.deltaTime;
* print (“inside”);*
* }*
* }*
* groundMesh.vertices = groundVertices;*
* groundMesh.RecalculateNormals ();*
* groundMesh.RecalculateBounds ();*
* }*