32 lines
639 B
C#
32 lines
639 B
C#
using Godot;
|
|
using System;
|
|
using Vim.Math3d;
|
|
|
|
[Tool]
|
|
public class Planet : Spatial, IPointMass
|
|
{
|
|
[Export]
|
|
public float Mass { get; set; }
|
|
|
|
private DVector3? _position;
|
|
public DVector3 Position
|
|
{
|
|
get
|
|
{
|
|
if (_position.HasValue) return _position.Value;
|
|
|
|
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
|
|
};
|
|
}
|
|
}
|
|
} |