2022-08-31 22:18:47 +02:00
|
|
|
using Godot;
|
|
|
|
using System;
|
2022-09-04 12:35:13 +02:00
|
|
|
using Vim.Math3d;
|
2022-08-31 22:18:47 +02:00
|
|
|
|
2022-09-04 12:35:13 +02:00
|
|
|
[Tool]
|
|
|
|
public class Planet : Spatial, IPointMass
|
2022-08-31 22:18:47 +02:00
|
|
|
{
|
|
|
|
[Export]
|
|
|
|
public float Mass { get; set; }
|
|
|
|
|
2022-09-04 12:35:13 +02:00
|
|
|
private DVector3? _position;
|
|
|
|
public DVector3 Position
|
2022-08-31 22:18:47 +02:00
|
|
|
{
|
2022-09-04 12:35:13 +02:00
|
|
|
get
|
|
|
|
{
|
|
|
|
if (_position.HasValue) return _position.Value;
|
2022-08-31 22:18:47 +02:00
|
|
|
|
2022-09-04 12:35:13 +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
|
|
|
}
|
2022-09-04 12:35:13 +02:00
|
|
|
}
|