Skip to content

Commit

Permalink
Update AsteroidSettings.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
InvalidArgument3 committed Jun 8, 2024
1 parent 38a582a commit 7a7984c
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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;

Expand Down

0 comments on commit 7a7984c

Please sign in to comment.