shmodot/scripts/orbits/PointMass.cs

26 lines
553 B
C#

using Godot;
public struct PointMass : IMassive, ILocation
{
public float Mass => _massive == null ? _mass : _massive.Mass;
public Vector3 Position => _spatial.Translation;
private IMassive _massive;
private Spatial _spatial;
private float _mass;
public PointMass(Spatial spatial, IMassive massive)
{
_spatial = spatial;
_massive = massive;
_mass = 0;
}
public PointMass(Spatial spatial, float mass)
{
_spatial = spatial;
_massive = null;
_mass = mass;
}
}