Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. public float heightScale = 20f;
  2. public float detailScale = 20f;
  3.  
  4. float seed;
  5. // Use this for initialization
  6. void Start()
  7. {
  8.  
  9. //if (instance == null)
  10. // instance = this;
  11.  
  12.  
  13.  
  14. for (int x = 0; x < mapSizeX; x++)
  15. {
  16. for (int z = 0; z < mapSizeZ; z++)
  17. {
  18. int y = (int)(Mathf.PerlinNoise((x + seed) / detailScale, (z + seed) / detailScale) * heightScale);
  19.  
  20. GameObject g = Instantiate(grass) as GameObject;
  21. g.transform.position = new Vector3(x, y , z);
  22. g.transform.SetParent(this.transform);
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30. }
  31. }
  32.  
  33. }`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement