From 7a7984c1672085e4108f8a6a0943812a71411b82 Mon Sep 17 00:00:00 2001 From: InvalidArgument3 Date: Sat, 8 Jun 2024 10:39:24 -0500 Subject: [PATCH] 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;