From 7a7984c1672085e4108f8a6a0943812a71411b82 Mon Sep 17 00:00:00 2001 From: InvalidArgument3 Date: Sat, 8 Jun 2024 10:39:24 -0500 Subject: [PATCH 1/3] Update AsteroidSettings.cs --- .../Scripts/DynamicAsteroids/AsteroidSettings.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Dynamic Asteroids/Data/Scripts/DynamicAsteroids/AsteroidSettings.cs b/Dynamic Asteroids/Data/Scripts/DynamicAsteroids/AsteroidSettings.cs index 973f6440..49b9393d 100644 --- a/Dynamic Asteroids/Data/Scripts/DynamicAsteroids/AsteroidSettings.cs +++ b/Dynamic Asteroids/Data/Scripts/DynamicAsteroids/AsteroidSettings.cs @@ -9,12 +9,13 @@ internal static class AsteroidSettings public static int MaxAsteroidCount = 1000; public static int AsteroidSpawnRadius = 10000; public static int AsteroidVelocityBase = 0; - public static double VelocityVariability = 10; // New setting for velocity variability - public static double AngularVelocityVariability = 0.1; // New setting for angular velocity variability + public static double VelocityVariability = 10; + public static double AngularVelocityVariabilityMin = 0.05; + public static double AngularVelocityVariabilityMax = 0.15; // Weights for asteroid type frequencies - public static double IceWeight = 0.45; // 45% - public static double StoneWeight = 0.45; // 45% + public static double IceWeight = 0.45; + public static double StoneWeight = 0.45; public static double IronWeight = 0.01; public static double NickelWeight = 0.01; public static double CobaltWeight = 0.01; @@ -88,6 +89,11 @@ public static AsteroidType GetRandomAsteroidType(Random rand) randomValue -= PlatinumWeight; return AsteroidType.Uraninite; } + + public static double GetRandomAngularVelocity(Random rand) + { + return AngularVelocityVariabilityMin + (rand.NextDouble() * (AngularVelocityVariabilityMax - AngularVelocityVariabilityMin)); + } } internal class SpawnableArea @@ -103,11 +109,9 @@ public bool ContainsPoint(Vector3D point) point -= CenterPosition; double pointDistanceSq = point.LengthSquared(); - // squared is more performant if (pointDistanceSq > Radius * Radius || pointDistanceSq < InnerRadius * InnerRadius) return false; - // Calculate HeightFromCenter if (Math.Abs(Vector3D.Dot(point, Normal)) > HeightFromCenter) return false; From f6d8144a283f8b6500ef89389ba3e2f753a3a2dc Mon Sep 17 00:00:00 2001 From: InvalidArgument3 Date: Sat, 8 Jun 2024 10:42:21 -0500 Subject: [PATCH 2/3] Update AsteroidSettings.cs --- .../Scripts/DynamicAsteroids/AsteroidSettings.cs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Dynamic Asteroids/Data/Scripts/DynamicAsteroids/AsteroidSettings.cs b/Dynamic Asteroids/Data/Scripts/DynamicAsteroids/AsteroidSettings.cs index 49b9393d..cfa09750 100644 --- a/Dynamic Asteroids/Data/Scripts/DynamicAsteroids/AsteroidSettings.cs +++ b/Dynamic Asteroids/Data/Scripts/DynamicAsteroids/AsteroidSettings.cs @@ -9,13 +9,12 @@ internal static class AsteroidSettings public static int MaxAsteroidCount = 1000; public static int AsteroidSpawnRadius = 10000; public static int AsteroidVelocityBase = 0; - public static double VelocityVariability = 10; - public static double AngularVelocityVariabilityMin = 0.05; - public static double AngularVelocityVariabilityMax = 0.15; + public static double VelocityVariability = 0; // New setting for velocity variability + public static double AngularVelocityVariability = 0; // New setting for angular velocity variability // Weights for asteroid type frequencies - public static double IceWeight = 0.45; - public static double StoneWeight = 0.45; + public static double IceWeight = 0.45; // 45% + public static double StoneWeight = 0.45; // 45% public static double IronWeight = 0.01; public static double NickelWeight = 0.01; public static double CobaltWeight = 0.01; @@ -89,11 +88,6 @@ public static AsteroidType GetRandomAsteroidType(Random rand) randomValue -= PlatinumWeight; return AsteroidType.Uraninite; } - - public static double GetRandomAngularVelocity(Random rand) - { - return AngularVelocityVariabilityMin + (rand.NextDouble() * (AngularVelocityVariabilityMax - AngularVelocityVariabilityMin)); - } } internal class SpawnableArea @@ -109,9 +103,11 @@ public bool ContainsPoint(Vector3D point) point -= CenterPosition; double pointDistanceSq = point.LengthSquared(); + // squared is more performant if (pointDistanceSq > Radius * Radius || pointDistanceSq < InnerRadius * InnerRadius) return false; + // Calculate HeightFromCenter if (Math.Abs(Vector3D.Dot(point, Normal)) > HeightFromCenter) return false; From 208fe354b003d14fff9dedcc9ad0bf33054d72eb Mon Sep 17 00:00:00 2001 From: InvalidArgument3 Date: Sat, 8 Jun 2024 10:54:31 -0500 Subject: [PATCH 3/3] Update AsteroidSettings.cs --- .../Data/Scripts/DynamicAsteroids/AsteroidSettings.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dynamic Asteroids/Data/Scripts/DynamicAsteroids/AsteroidSettings.cs b/Dynamic Asteroids/Data/Scripts/DynamicAsteroids/AsteroidSettings.cs index cfa09750..973f6440 100644 --- a/Dynamic Asteroids/Data/Scripts/DynamicAsteroids/AsteroidSettings.cs +++ b/Dynamic Asteroids/Data/Scripts/DynamicAsteroids/AsteroidSettings.cs @@ -9,8 +9,8 @@ internal static class AsteroidSettings public static int MaxAsteroidCount = 1000; public static int AsteroidSpawnRadius = 10000; public static int AsteroidVelocityBase = 0; - public static double VelocityVariability = 0; // New setting for velocity variability - public static double AngularVelocityVariability = 0; // New setting for angular velocity variability + public static double VelocityVariability = 10; // New setting for velocity variability + public static double AngularVelocityVariability = 0.1; // New setting for angular velocity variability // Weights for asteroid type frequencies public static double IceWeight = 0.45; // 45%