Krakensbane is working
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using System.Diagnostics;
|
||||
using Godot;
|
||||
using ImGuiNET;
|
||||
using Quadratic.Carto.MathExt;
|
||||
|
||||
namespace Quadratic.Carto.Craft;
|
||||
|
||||
@@ -14,23 +16,26 @@ namespace Quadratic.Carto.Craft;
|
||||
/// </remarks>
|
||||
public sealed partial class Krakensbane : Node3D
|
||||
{
|
||||
Node3D? focusedVessel = null;
|
||||
[Export]
|
||||
public Node3D? FocusedVessel { get; set; }
|
||||
|
||||
const float maxDistance = 500.0f;
|
||||
|
||||
DVector3 originPosition = DVector3.Zero;
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
Debug.Assert(
|
||||
focusedVessel == null || focusedVessel.GetParent() == this,
|
||||
FocusedVessel == null || FocusedVessel.GetParent() == this,
|
||||
"Focused vessel must be a direct descendant of Krakensbane"
|
||||
);
|
||||
|
||||
if (focusedVessel == null)
|
||||
if (FocusedVessel == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var vesselPosition = focusedVessel.Transform.Origin;
|
||||
var vesselPosition = FocusedVessel.Transform.Origin;
|
||||
var vesselDistance = vesselPosition.Length();
|
||||
if (vesselDistance > maxDistance)
|
||||
{
|
||||
@@ -45,7 +50,14 @@ public sealed partial class Krakensbane : Node3D
|
||||
child.Transform = applyTransform * child.Transform;
|
||||
}
|
||||
|
||||
GD.Print($"Resetting position; delta = {-vesselPosition}");
|
||||
originPosition += vesselPosition.AsVim().AsDouble();
|
||||
}
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
ImGui.Begin("Krakensbane");
|
||||
ImGui.Text($"Origin: {originPosition}");
|
||||
ImGui.End();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user