Skip to content
Snippets Groups Projects
Commit 8c9c2b05 authored by Julian Thijssen's avatar Julian Thijssen
Browse files

Lower cliffs and meander the rivers a little

parent 7d693036
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,7 @@ public class CliffAgent : ScriptableObject
private Vector2Int pos;
private float cliffHeight = 0.6f;
private float cliffHeight = 0.4f;
// Start is called before the first frame update
void Start()
......
......@@ -10,7 +10,7 @@ public class RiverAgent : MonoBehaviour
private float cliffHeight = 0.6f;
private Vector2 direction;
private Vector2 origDir;
// Start is called before the first frame update
void Start()
......@@ -41,10 +41,17 @@ public class RiverAgent : MonoBehaviour
int size = heightmap.getSize();
pos = new Vector2Int(size / 2, size / 2);
direction = Random.insideUnitCircle;
origDir = Random.insideUnitCircle;
Vector2 direction = origDir;
for (int i = 0; i < 1000; i++)
{
Vector2 randDir = Random.insideUnitCircle;
randDir = Vector2.Dot(direction, randDir) > 0 ? randDir : -randDir;
Vector2 deviation = randDir * 0.5f;
direction += deviation;
direction.Normalize();
pos += direction;
Vector2Int intPos = new Vector2Int((int) pos.x, (int) pos.y);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment