shmodot/scripts/orbits/Planet.cs

32 lines
640 B
C#
Raw Normal View History

2022-08-31 22:18:47 +02:00
using Godot;
using System;
using Vim.Math3d;
2022-08-31 22:18:47 +02:00
[Tool]
public class Planet : Spatial, IPointMass
2022-08-31 22:18:47 +02:00
{
[Export]
2022-09-07 01:49:57 +02:00
public double Mass { get; set; }
2022-08-31 22:18:47 +02:00
private DVector3? _position;
public DVector3 Position
2022-08-31 22:18:47 +02:00
{
get
{
if (_position.HasValue) return _position.Value;
2022-08-31 22:18:47 +02:00
var t = Translation;
return new DVector3(t.x, t.y, t.z);
}
set
{
_position = value;
Translation = new Godot.Vector3
{
x = (float)value.X,
y = (float)value.Y,
z = (float)value.Z
};
}
2022-08-31 22:18:47 +02:00
}
}