Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Start () {
- float scale = (transform.localScale.x + transform.localScale.y + transform.localScale.z) *0.3f;
- Mesh mesh = gameObject.GetComponent<MeshFilter>().mesh;
- Vector3[] peturbedVertices = new Vector3[mesh.vertices.Length];
- for (int i = 0; i < mesh.vertices.Length; i++) {
- peturbedVertices[i] = mesh.vertices[i] + Random.onUnitSphere * .1f * scale;
- }
- mesh.vertices = peturbedVertices;
- mesh.RecalculateNormals ();
- }
Advertisement
Add Comment
Please, Sign In to add comment