- Home /
I am trying to deform a mesh (Plane) imported from Blender
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[i])){
groundVertices [i].y += 100f*Time.deltaTime;
print ("inside");
}
}
groundMesh.vertices = groundVertices;
groundMesh.RecalculateNormals ();
groundMesh.RecalculateBounds ();
}
Answer by FonsWesselius · Jan 17, 2019 at 12:39 PM
@atylerrice did you find a solution for this problem? I'm struggling with this problem at the moment...,Did you find a solution for this problem? I'm struggling with this problem right now...
Your answer
Follow this Question
Related Questions
Why aren't the mesh collider and mesh filter meshes saved in prefab children? 2 Answers
Object mesh collider acting strange 0 Answers
How to manipulate(flatten) the Mesh of an object 0 Answers
Mesh problem with a blender model - Problème de mesh avec un model de blender 0 Answers
How to access mesh from Scriptable Object directly? 1 Answer