shmodot/scripts/orbits/PointMass.cs

26 lines
553 B
C#
Raw Normal View History

2022-08-31 22:18:47 +02:00
using Godot;
2022-09-04 12:35:13 +02:00
public struct PointMass : IMassive, ILocation
2022-08-31 22:18:47 +02:00
{
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;
}
}