Core radius is the Roche curve; the global exaggeration divides by the core's growth
core-at-roche-and-exaggeration-up: PlanetSettings.CoreRadius and Planet.CoreRadius are deleted; the well's softened core reads the RocheLimit curve (one curve of mass). The core < Roche guard cannot fail and is replaced by a Roche-limit-positive-and-finite check. Settings.asset: CoreRadius removed, HeightExaggeration 10 -> 4.0983607 (10 / (7.32 / 3)). Tests pin the new curves and the peak drawn slope / 2.44x steeper tail. Not yet built or run at this commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
0d7fc2ee3a
commit
8f491fd3c9
9 changed files with 63 additions and 81 deletions
|
|
@ -16,13 +16,12 @@ public class PlanetSettings
|
|||
public ExponentialCurve LightRadius;
|
||||
public ExponentialCurve BodyRadius;
|
||||
|
||||
// The closest a child may orbit its parent, in u, by the parent's mass. Authored like BodyRadius, never per body.
|
||||
// The closest a child may orbit its parent, in u, by the parent's mass, and the softened core radius of the parent's
|
||||
// well (the steepest drawn slope sits at the Roche limit). Authored like BodyRadius, never per body.
|
||||
public ExponentialCurve RocheLimit = new ExponentialCurve();
|
||||
|
||||
// A body's well, by its mass (GravityField): its strength c in u^2/s^2 (the pull is c / r beyond the core) and its
|
||||
// softened core radius in u, which must stay inside the RocheLimit curve.
|
||||
// A body's well strength by its mass (GravityField): c in u^2/s^2 (the pull is c / r beyond the core, which is the Roche limit).
|
||||
public ExponentialCurve WellStrength = new ExponentialCurve();
|
||||
public ExponentialCurve CoreRadius = new ExponentialCurve();
|
||||
|
||||
// The one global exaggeration of gravity height: height = potential / K, in u/s^2 per unit of height.
|
||||
public float HeightExaggeration = 1f;
|
||||
|
|
|
|||
|
|
@ -614,7 +614,7 @@ public class Zone
|
|||
|
||||
// The potential of a body's well at the zone's edge, subtracted so every well is zero there: the one owner of the
|
||||
// reference. GetHeight sums with it and the renderer's lowering (GravityLowering) hands it to the shader unchanged.
|
||||
public float WellReference(Planet body) => GravityField.Potential(body.WellStrength, body.CoreRadius, Pack.Radius);
|
||||
public float WellReference(Planet body) => GravityField.Potential(body.WellStrength, body.RocheLimit, Pack.Radius);
|
||||
|
||||
public float GetHeight(float2 position)
|
||||
{
|
||||
|
|
@ -622,7 +622,7 @@ public class Zone
|
|||
foreach (var body in PlanetInstances.Values)
|
||||
{
|
||||
var offset = position - body.Orbit.Position;
|
||||
result += GravityField.Potential(body.WellStrength, body.CoreRadius, length(offset)) - WellReference(body);
|
||||
result += GravityField.Potential(body.WellStrength, body.RocheLimit, length(offset)) - WellReference(body);
|
||||
}
|
||||
|
||||
return result / Settings.HeightExaggeration;
|
||||
|
|
@ -652,7 +652,7 @@ public class Zone
|
|||
{
|
||||
var force = float2.zero;
|
||||
foreach (var body in PlanetInstances.Values)
|
||||
force += GravityField.Acceleration(body.WellStrength, body.CoreRadius, position - body.Orbit.Position);
|
||||
force += GravityField.Acceleration(body.WellStrength, body.RocheLimit, position - body.Orbit.Position);
|
||||
return force;
|
||||
}
|
||||
|
||||
|
|
@ -690,10 +690,9 @@ public class Planet
|
|||
public BodyData BodyData;
|
||||
public float BodyRadius;
|
||||
|
||||
// The well (GravityField): strength c and softened core radius R by mass, and the Roche limit, the closest a child
|
||||
// may orbit. All three are authored PlanetSettings curves of mass; the core must sit inside the Roche limit.
|
||||
// The well (GravityField): strength c by mass, and the Roche limit, which is both the closest a child may orbit and
|
||||
// the well's softened core radius R (one curve of mass, never per body). Both are authored PlanetSettings curves.
|
||||
public float WellStrength;
|
||||
public float CoreRadius;
|
||||
public float RocheLimit;
|
||||
|
||||
public Planet(PlanetSettings settings, BodyData data, Orbit orbit)
|
||||
|
|
@ -708,12 +707,11 @@ public class Planet
|
|||
{
|
||||
BodyRadius = Settings.BodyRadius.Evaluate(BodyData.Mass) * BodyData.BodyRadiusMultiplier;
|
||||
WellStrength = Settings.WellStrength.Evaluate(BodyData.Mass);
|
||||
CoreRadius = Settings.CoreRadius.Evaluate(BodyData.Mass);
|
||||
RocheLimit = Settings.RocheLimit.Evaluate(BodyData.Mass);
|
||||
if (!(WellStrength >= 0f) || float.IsInfinity(WellStrength))
|
||||
throw new InvalidOperationException("A body's well strength must be finite and not negative (PlanetSettings.WellStrength).");
|
||||
if (WellStrength > 0 && !(0 < CoreRadius && CoreRadius < RocheLimit))
|
||||
throw new InvalidOperationException("A body's core radius must be positive and inside its Roche limit (PlanetSettings.CoreRadius, RocheLimit).");
|
||||
if (WellStrength > 0 && !(RocheLimit > 0f && !float.IsInfinity(RocheLimit)))
|
||||
throw new InvalidOperationException("A body's Roche limit, which is its core radius, must be positive and finite (PlanetSettings.RocheLimit).");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue