- Home /
How can i translate mesh vertex point used touch on Android
How can i translate mesh vertex point used touch on Android (It should stay on when I stop touch).
I want to stretch and shrink the mesh object same as skin stretch and shrink
how Should i solve problem?
MeshScrip Code;
using UnityEngine; using System.Collections;
public class BuildMesh : MonoBehaviour{
public Vector3[] vertices = new Vector3[4];
// Use this for initialization
void Start () {
MeshFilter mf = GetComponent<MeshFilter>();
Mesh mesh = mf.mesh;
//Vertices
vertices[0] = new Vector3(0,0,0);
vertices[1] = new Vector3(10,0,0);
vertices[2] = new Vector3(0,10,0);
vertices[3] = new Vector3(10,10,0);
//indexs
int[] triangles = new int[6]{
0,2,1,
1,2,3
};
Vector2[] uv = new Vector2[4]{
new Vector2(0, 0),
new Vector2(1, 0),
new Vector2(0, 1),
new Vector2(1, 1)
};
mesh.Clear();
mesh.vertices = vertices;
mesh.triangles = triangles;
mesh.uv = uv;
mesh.RecalculateNormals();
}
}
Comment