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

Remove small bias in random directions

parent a5f018dc
No related branches found
No related tags found
No related merge requests found
......@@ -36,7 +36,7 @@ public class CoastlineAgent
if(bitangent == Vector2.zero) // in case of the first agent, just create any random pref direction
{
prefDirection = new Vector2(Random.Range(-1.0f, 1.0f), Random.Range(-1.0f, 1.0f));
prefDirection = Random.insideUnitCircle;
prefDirection.Normalize();
}
else
......@@ -56,7 +56,7 @@ public class CoastlineAgent
}
// create random attractor / repulsor and make sure they point at different directions
Vector2 direction = new Vector2(Random.Range(-1.0f, 1.0f), Random.Range(-1.0f, 1.0f)).normalized * coastlineGenerator.ActionRadius;
Vector2 direction = Random.insideUnitCircle * coastlineGenerator.ActionRadius;
attractor = position + direction;
repulsor = position + RotateVector(-direction, Random.Range(-90f, 90));
}
......
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