Returns a copy of the vertex positions or assigns a new vertex positions array.
function Update () { var mesh : Mesh = GetComponent(MeshFilter).mesh; var vertices : Vector3[] = mesh.vertices; for (var i = 0; i < vertices.Length; i++) vertices[i] += Vector3.up * Time.deltaTime; mesh.vertices = vertices; mesh.RecalculateBounds(); }
using UnityEngine; using System.Collections; public class Example : MonoBehaviour { void Update() { Mesh mesh = GetComponent<MeshFilter>().mesh; Vector3[] vertices = mesh.vertices; int i = 0; while (i < vertices.Length) { vertices[i] += Vector3.up * Time.deltaTime; i++; } mesh.vertices = vertices; mesh.RecalculateBounds(); } }
import UnityEngine import System.Collections public class Example(MonoBehaviour): def Update() as void: mesh as Mesh = GetComponent[of MeshFilter]().mesh vertices as (Vector3) = mesh.vertices i as int = 0 while i < vertices.Length: vertices[i] += (Vector3.up * Time.deltaTime) i++ mesh.vertices = vertices mesh.RecalculateBounds()