Krakensbane is working
This commit is contained in:
parent
2b051a710b
commit
a6e116c77f
@ -1,16 +1,7 @@
|
|||||||
[gd_scene load_steps=11 format=3 uid="uid://tht1tf5iq6lw"]
|
[gd_scene load_steps=12 format=3 uid="uid://tht1tf5iq6lw"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://src/testing/TestThruster.cs" id="1_y7wni"]
|
[ext_resource type="Script" path="res://src/Craft/Krakensbane.cs" id="1_ju4qj"]
|
||||||
|
[ext_resource type="Script" path="res://src/Testing/TestThruster.cs" id="2_1t1tx"]
|
||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_xxi7g"]
|
|
||||||
size = Vector3(16.9697, 0.0310059, 15.6934)
|
|
||||||
|
|
||||||
[sub_resource type="PlaneMesh" id="PlaneMesh_xcndr"]
|
|
||||||
size = Vector2(20, 20)
|
|
||||||
|
|
||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_8al46"]
|
|
||||||
|
|
||||||
[sub_resource type="BoxMesh" id="BoxMesh_jgj3c"]
|
|
||||||
|
|
||||||
[sub_resource type="PhysicalSkyMaterial" id="PhysicalSkyMaterial_uxbcq"]
|
[sub_resource type="PhysicalSkyMaterial" id="PhysicalSkyMaterial_uxbcq"]
|
||||||
|
|
||||||
@ -25,32 +16,18 @@ sky = SubResource("Sky_iakm3")
|
|||||||
|
|
||||||
[sub_resource type="Compositor" id="Compositor_tt8nt"]
|
[sub_resource type="Compositor" id="Compositor_tt8nt"]
|
||||||
|
|
||||||
|
[sub_resource type="BoxShape3D" id="BoxShape3D_8al46"]
|
||||||
|
|
||||||
|
[sub_resource type="BoxMesh" id="BoxMesh_jgj3c"]
|
||||||
|
|
||||||
|
[sub_resource type="BoxShape3D" id="BoxShape3D_xxi7g"]
|
||||||
|
size = Vector3(16.9697, 0.0310059, 15.6934)
|
||||||
|
|
||||||
|
[sub_resource type="PlaneMesh" id="PlaneMesh_xcndr"]
|
||||||
|
size = Vector2(20, 20)
|
||||||
|
|
||||||
[node name="root" type="Node3D"]
|
[node name="root" type="Node3D"]
|
||||||
|
|
||||||
[node name="ground" type="StaticBody3D" parent="."]
|
|
||||||
disable_mode = 1
|
|
||||||
input_ray_pickable = false
|
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="ground"]
|
|
||||||
shape = SubResource("BoxShape3D_xxi7g")
|
|
||||||
|
|
||||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="ground"]
|
|
||||||
mesh = SubResource("PlaneMesh_xcndr")
|
|
||||||
|
|
||||||
[node name="test-rocket" type="RigidBody3D" parent="."]
|
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.815224, 0)
|
|
||||||
script = ExtResource("1_y7wni")
|
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="test-rocket"]
|
|
||||||
shape = SubResource("BoxShape3D_8al46")
|
|
||||||
|
|
||||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="test-rocket"]
|
|
||||||
mesh = SubResource("BoxMesh_jgj3c")
|
|
||||||
|
|
||||||
[node name="Camera3D" type="Camera3D" parent="test-rocket"]
|
|
||||||
transform = Transform3D(1, 0, 0, 0, 0.91772, 0.397228, 0, -0.397228, 0.91772, 0, 4.51745, 14.147)
|
|
||||||
current = true
|
|
||||||
|
|
||||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||||
transform = Transform3D(0.767277, -0.356166, -0.533322, 0.641316, 0.42612, 0.638072, 0, -0.831605, 0.555367, -9.52374, 5.38917, 8.97674)
|
transform = Transform3D(0.767277, -0.356166, -0.533322, 0.641316, 0.42612, 0.638072, 0, -0.831605, 0.555367, -9.52374, 5.38917, 8.97674)
|
||||||
|
|
||||||
@ -58,3 +35,31 @@ transform = Transform3D(0.767277, -0.356166, -0.533322, 0.641316, 0.42612, 0.638
|
|||||||
environment = SubResource("Environment_0rcmt")
|
environment = SubResource("Environment_0rcmt")
|
||||||
camera_attributes = SubResource("CameraAttributesPhysical_irbnp")
|
camera_attributes = SubResource("CameraAttributesPhysical_irbnp")
|
||||||
compositor = SubResource("Compositor_tt8nt")
|
compositor = SubResource("Compositor_tt8nt")
|
||||||
|
|
||||||
|
[node name="FloatingOriginRoot" type="Node3D" parent="." node_paths=PackedStringArray("FocusedVessel")]
|
||||||
|
script = ExtResource("1_ju4qj")
|
||||||
|
FocusedVessel = NodePath("test-rocket")
|
||||||
|
|
||||||
|
[node name="test-rocket" type="RigidBody3D" parent="FloatingOriginRoot"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.815224, 0)
|
||||||
|
script = ExtResource("2_1t1tx")
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="FloatingOriginRoot/test-rocket"]
|
||||||
|
shape = SubResource("BoxShape3D_8al46")
|
||||||
|
|
||||||
|
[node name="MeshInstance3D" type="MeshInstance3D" parent="FloatingOriginRoot/test-rocket"]
|
||||||
|
mesh = SubResource("BoxMesh_jgj3c")
|
||||||
|
|
||||||
|
[node name="Camera3D" type="Camera3D" parent="FloatingOriginRoot/test-rocket"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 0.91772, 0.397228, 0, -0.397228, 0.91772, 0, 4.51745, 14.147)
|
||||||
|
current = true
|
||||||
|
|
||||||
|
[node name="ground" type="StaticBody3D" parent="FloatingOriginRoot"]
|
||||||
|
disable_mode = 1
|
||||||
|
input_ray_pickable = false
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="FloatingOriginRoot/ground"]
|
||||||
|
shape = SubResource("BoxShape3D_xxi7g")
|
||||||
|
|
||||||
|
[node name="MeshInstance3D" type="MeshInstance3D" parent="FloatingOriginRoot/ground"]
|
||||||
|
mesh = SubResource("PlaneMesh_xcndr")
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
using ImGuiNET;
|
||||||
|
using Quadratic.Carto.MathExt;
|
||||||
|
|
||||||
namespace Quadratic.Carto.Craft;
|
namespace Quadratic.Carto.Craft;
|
||||||
|
|
||||||
@ -14,23 +16,26 @@ namespace Quadratic.Carto.Craft;
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
public sealed partial class Krakensbane : Node3D
|
public sealed partial class Krakensbane : Node3D
|
||||||
{
|
{
|
||||||
Node3D? focusedVessel = null;
|
[Export]
|
||||||
|
public Node3D? FocusedVessel { get; set; }
|
||||||
|
|
||||||
const float maxDistance = 500.0f;
|
const float maxDistance = 500.0f;
|
||||||
|
|
||||||
|
DVector3 originPosition = DVector3.Zero;
|
||||||
|
|
||||||
public override void _PhysicsProcess(double delta)
|
public override void _PhysicsProcess(double delta)
|
||||||
{
|
{
|
||||||
Debug.Assert(
|
Debug.Assert(
|
||||||
focusedVessel == null || focusedVessel.GetParent() == this,
|
FocusedVessel == null || FocusedVessel.GetParent() == this,
|
||||||
"Focused vessel must be a direct descendant of Krakensbane"
|
"Focused vessel must be a direct descendant of Krakensbane"
|
||||||
);
|
);
|
||||||
|
|
||||||
if (focusedVessel == null)
|
if (FocusedVessel == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var vesselPosition = focusedVessel.Transform.Origin;
|
var vesselPosition = FocusedVessel.Transform.Origin;
|
||||||
var vesselDistance = vesselPosition.Length();
|
var vesselDistance = vesselPosition.Length();
|
||||||
if (vesselDistance > maxDistance)
|
if (vesselDistance > maxDistance)
|
||||||
{
|
{
|
||||||
@ -45,7 +50,14 @@ public sealed partial class Krakensbane : Node3D
|
|||||||
child.Transform = applyTransform * child.Transform;
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
16
src/GlobalUsing.cs
Normal file
16
src/GlobalUsing.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// These are the types used in the engine-independent core of the codebase.
|
||||||
|
// We add aliases for them to prevent namespace clash with Godot types.
|
||||||
|
global using VVector4 = Vim.Math3d.Vector4;
|
||||||
|
global using VVector3 = Vim.Math3d.Vector3;
|
||||||
|
global using VVector2 = Vim.Math3d.Vector2;
|
||||||
|
global using DVector4 = Vim.Math3d.DVector4;
|
||||||
|
global using DVector3 = Vim.Math3d.DVector3;
|
||||||
|
global using DVector2 = Vim.Math3d.DVector2;
|
||||||
|
global using VQuaternion = Vim.Math3d.Quaternion;
|
||||||
|
global using VMatrix4x4 = Vim.Math3d.Matrix4x4;
|
||||||
|
// Also alias System.Numerics types to prevent namespace clash with Godot types.
|
||||||
|
global using NVector4 = System.Numerics.Vector4;
|
||||||
|
global using NVector3 = System.Numerics.Vector3;
|
||||||
|
global using NVector2 = System.Numerics.Vector2;
|
||||||
|
global using NQuaternion = System.Numerics.Quaternion;
|
||||||
|
global using NMatrix4x4 = System.Numerics.Matrix4x4;
|
Loading…
Reference in New Issue
Block a user