diff --git a/Fungi growth simulation/Assets/Config.cs b/Fungi growth simulation/Assets/Config.cs index cdd52a6..8c01671 100644 --- a/Fungi growth simulation/Assets/Config.cs +++ b/Fungi growth simulation/Assets/Config.cs @@ -4,6 +4,19 @@ public class Config : MonoBehaviour { - public static float changeDirectionProbability = 0.2f; - public static int randomSeed = 2137; + public static float ChangeDirectionProbability = 0.04f; + public static float BranchingFactor = 0.02f; + public static int RandomSeed = 2137; + + // Start is called before the first frame update + void Start() + { + Application.targetFrameRate = 10; + } + + // Update is called once per frame + void Update() + { + + } } diff --git a/Fungi growth simulation/Assets/Helper.cs b/Fungi growth simulation/Assets/Helper.cs index 649d11f..c3fae15 100644 --- a/Fungi growth simulation/Assets/Helper.cs +++ b/Fungi growth simulation/Assets/Helper.cs @@ -4,7 +4,7 @@ public class Helper { - public static Random Rnd = new Random(Config.randomSeed); + public static Random Rnd = new Random(Config.RandomSeed); // https://stackoverflow.com/questions/218060/random-gaussian-variables public static float SampleFromNormalDistribution(double mean, double stdDev) diff --git a/Fungi growth simulation/Assets/Mushroom.cs b/Fungi growth simulation/Assets/Mushroom.cs index 429dff8..427cd72 100644 --- a/Fungi growth simulation/Assets/Mushroom.cs +++ b/Fungi growth simulation/Assets/Mushroom.cs @@ -40,7 +40,7 @@ void Update() Vector3 currPosition = GameObject.transform.position; Vector3 direction = currPosition - parentPosition; - if (Helper.Rnd.NextDouble() < 0.03f) + if (Helper.Rnd.NextDouble() < Config.BranchingFactor) { //Branch Vector3[] branchDirections = DirectionMethods.GetBranchDirection(Direction); Vector3 childPosition1 = currPosition + branchDirections[0].normalized; @@ -53,7 +53,7 @@ void Update() //Standart growth float angle = Helper.SampleFromNormalDistribution(56, 17); // Decide if we change direction - if (Helper.Rnd.NextDouble() < 0.04f) + if (Helper.Rnd.NextDouble() < Config.ChangeDirectionProbability) Direction = DirectionMethods.GetRandomPossibleDirection(Direction); Quaternion rotation = Quaternion.AngleAxis(angle, DirectionMethods.ToVector3(Direction));