Initial commit.

This commit is contained in:
Patrick Marsee 2025-09-03 18:24:08 -04:00
commit 907695442f
28 changed files with 717 additions and 0 deletions

View file

@ -0,0 +1,26 @@
[gd_resource type="Resource" script_class="Airfoil" load_steps=5 format=3 uid="uid://dpk3bgq54ajul"]
[ext_resource type="Script" uid="uid://jts0c0xrwc8q" path="res://scripts/aircraft/resources/airfoil.gd" id="1_bnq8l"]
[sub_resource type="Curve" id="Curve_bnq8l"]
_limits = [0.0, 0.25, -20.0, 20.0]
_data = [Vector2(-20, 0.25), 0.0, -0.0451077, 0, 0, Vector2(-15.2, 0.106742), -0.0196947, -0.0196947, 0, 0, Vector2(-10.2128, 0.0337079), -0.00684561, -0.00684561, 0, 0, Vector2(0, 0.011236), 0.0, 0.0, 0, 0, Vector2(10, 0.0337079), 0.00560095, 0.00560095, 0, 0, Vector2(14.8936, 0.0983146), 0.0198034, 0.0198034, 0, 0, Vector2(20, 0.25), 0.0490369, 0.0, 0, 0]
point_count = 7
[sub_resource type="Curve" id="Curve_fbf5p"]
_limits = [-1.5, 1.5, -20.0, 20.0]
bake_resolution = 80
_data = [Vector2(-13, -0.7), 0.0, 0.0, 0, 0, Vector2(-12, -1.1), 0.0, 0.0, 0, 0, Vector2(12, 1.1), 0.0, 0.0, 0, 0, Vector2(13, 0.7), 0.0, 0.0, 0, 0]
point_count = 4
[sub_resource type="Curve" id="Curve_iphra"]
_limits = [0.0, 1.0, -20.0, 20.0]
_data = [Vector2(-20, 0), 0.0, 0.0, 0, 0, Vector2(20, 0), 0.0, 0.0, 0, 0]
point_count = 2
[resource]
script = ExtResource("1_bnq8l")
lift_curve = SubResource("Curve_fbf5p")
drag_curve = SubResource("Curve_bnq8l")
moment_curve = SubResource("Curve_iphra")
metadata/_custom_type_script = "uid://jts0c0xrwc8q"

138
demo/demo.tscn Normal file
View file

@ -0,0 +1,138 @@
[gd_scene load_steps=18 format=3 uid="uid://d20jwlre5rc5m"]
[ext_resource type="Texture2D" uid="uid://bruwqvb6qrsfn" path="res://demo/textures/untexture.png" id="1_ytiva"]
[ext_resource type="Script" uid="uid://bddnsq0h2tpf" path="res://scripts/aircraft/nodes/fixed_wing_aircraft.gd" id="2_dar0o"]
[ext_resource type="Resource" uid="uid://dpk3bgq54ajul" path="res://demo/airfoils/symmetric.tres" id="3_u10mr"]
[ext_resource type="Script" uid="uid://qjdma7j2qrns" path="res://scripts/aircraft/resources/fixed_wing_aircraft_performance.gd" id="4_onu7k"]
[ext_resource type="Resource" uid="uid://p2i7a806s6gs" path="res://demo/propulsion/electric_motor.tres" id="4_s1s6j"]
[ext_resource type="Script" uid="uid://pc3j1c6e1ra7" path="res://scripts/aircraft/nodes/flight_sim_controller.gd" id="5_s1s6j"]
[ext_resource type="Script" uid="uid://tgj0rvn5wj8t" path="res://demo/hud.gd" id="6_onu7k"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_j5lb4"]
albedo_texture = ExtResource("1_ytiva")
uv1_scale = Vector3(100, 100, 100)
[sub_resource type="PlaneMesh" id="PlaneMesh_5hjng"]
material = SubResource("StandardMaterial3D_j5lb4")
size = Vector2(2000, 2000)
[sub_resource type="Curve" id="Curve_s1s6j"]
_limits = [0.0, 0.5, 0.0, 20.0]
_data = [Vector2(0, 0.5), 0.0, 0.0, 0, 0, Vector2(20, 0), -0.082397, 0.0, 0, 0]
point_count = 2
[sub_resource type="Curve" id="Curve_onvmd"]
_limits = [0.0, 2.0, 0.0, 30.0]
_data = [Vector2(0, 2), 0.0, 0.0, 0, 0, Vector2(30, 0), -0.199316, 0.0, 0, 0]
point_count = 2
[sub_resource type="Curve" id="Curve_oeqrt"]
_limits = [0.0, 0.202247, 0.0, 10.0]
_data = [Vector2(0, 0.202247), 0.0, 0.0, 0, 0, Vector2(10, 0), -0.0393259, 0.0, 0, 0]
point_count = 2
[sub_resource type="Resource" id="Resource_onu7k"]
script = ExtResource("4_onu7k")
horizontal_surface = ExtResource("3_u10mr")
horizontal_area = 21.8
horizontal_aspect_ratio = 5.83
horizontal_sweep = 0.0
vertical_surface = ExtResource("3_u10mr")
vertical_area = 5.0
vertical_aspect_ratio = 5.0
vertical_sweep = 0.0
propultion = ExtResource("4_s1s6j")
base_thrust = 100000.0
base_drag = 0.0
empty_mass = 3463.0
yaw_axis = Vector3(0, -1, 0)
roll_axis = Vector3(0, 0.1, -1)
pitch_stability = 0.0
yaw_stability = 0.0
roll_stability = 0.0
reference_ias_mps = 100.0
braking_power = 0.0
pitch_power = SubResource("Curve_s1s6j")
yaw_power = SubResource("Curve_oeqrt")
roll_power = SubResource("Curve_onvmd")
metadata/_custom_type_script = "uid://qjdma7j2qrns"
[sub_resource type="SphereShape3D" id="SphereShape3D_u10mr"]
radius = 8.0
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_onu7k"]
[sub_resource type="Sky" id="Sky_s1s6j"]
sky_material = SubResource("ProceduralSkyMaterial_onu7k")
[sub_resource type="Environment" id="Environment_onvmd"]
background_mode = 2
sky = SubResource("Sky_s1s6j")
ambient_light_source = 3
ambient_light_color = Color(1, 1, 1, 1)
[node name="Demo" type="Node3D"]
[node name="Ground" type="MeshInstance3D" parent="."]
mesh = SubResource("PlaneMesh_5hjng")
[node name="FixedWingAircraft" type="CharacterBody3D" parent="." node_paths=PackedStringArray("controller")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 10, 0)
script = ExtResource("2_dar0o")
performance = SubResource("Resource_onu7k")
controller = NodePath("FlightSimController")
initial_speed = 100.0
metadata/_custom_type_script = "uid://bddnsq0h2tpf"
[node name="CollisionShape3D" type="CollisionShape3D" parent="FixedWingAircraft"]
shape = SubResource("SphereShape3D_u10mr")
[node name="FlightSimController" type="Node" parent="FixedWingAircraft"]
script = ExtResource("5_s1s6j")
pitch_speed = 4.0
yaw_speed = 4.0
roll_speed = 3.0
metadata/_custom_type_script = "uid://pc3j1c6e1ra7"
[node name="Camera3D" type="Camera3D" parent="FixedWingAircraft"]
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="HUD" type="Control" parent="CanvasLayer" node_paths=PackedStringArray("source")]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("6_onu7k")
source = NodePath("../../FixedWingAircraft")
[node name="TAS_Label" type="Label" parent="CanvasLayer/HUD"]
layout_mode = 0
offset_right = 40.0
offset_bottom = 32.0
[node name="AOA_Label" type="Label" parent="CanvasLayer/HUD"]
layout_mode = 0
offset_top = 32.0
offset_right = 40.0
offset_bottom = 64.0
[node name="SideslipLabel" type="Label" parent="CanvasLayer/HUD"]
layout_mode = 0
offset_top = 64.0
offset_right = 40.0
offset_bottom = 96.0
[node name="RelativeVelocityLabel" type="Label" parent="CanvasLayer/HUD"]
layout_mode = 0
offset_top = 96.0
offset_right = 40.0
offset_bottom = 128.0
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_onvmd")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(-4.37114e-08, -0.984808, 0.173648, 0, 0.173648, 0.984808, -1, 4.30473e-08, -7.5904e-09, 0, 0, 0)

15
demo/hud.gd Normal file
View file

@ -0,0 +1,15 @@
class_name HUD
extends Control
@export var source: FixedWingAircraft
@onready var tas_label := $TAS_Label as Label
@onready var aoa_label := $AOA_Label as Label
@onready var sideslip_label := $SideslipLabel as Label
@onready var relative_velocity_label := $RelativeVelocityLabel as Label
func _process(_delta: float) -> void:
tas_label.text = "TAS: %s" % source.m_tas
aoa_label.text = "AOA: %s" % rad_to_deg(source.m_aoa)
sideslip_label.text = "Sideslip: %s" % rad_to_deg(source.m_sideslip)
relative_velocity_label.text = "V: %s" % source.m_relative_velocity

1
demo/hud.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://tgj0rvn5wj8t

View file

@ -0,0 +1,22 @@
[gd_resource type="Resource" script_class="Propultion" load_steps=5 format=3 uid="uid://p2i7a806s6gs"]
[ext_resource type="Script" uid="uid://8fsi1mq555uj" path="res://scripts/aircraft/resources/propultion.gd" id="1_idr77"]
[sub_resource type="Curve" id="Curve_idr77"]
_data = [Vector2(0, 0), 0.0, 2.81648, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0]
point_count = 2
[sub_resource type="Curve" id="Curve_sw002"]
_data = [Vector2(0, 1), 0.0, -2.57766, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 2
[sub_resource type="Curve" id="Curve_jnvlh"]
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0]
point_count = 2
[resource]
script = ExtResource("1_idr77")
propultion_speed_curve = SubResource("Curve_sw002")
propultion_density_curve = SubResource("Curve_idr77")
propultion_temperature_curve = SubResource("Curve_jnvlh")
metadata/_custom_type_script = "uid://8fsi1mq555uj"

BIN
demo/textures/untexture.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bruwqvb6qrsfn"
path.s3tc="res://.godot/imported/untexture.png-e9b4c6dd107bfceece0daf5f5dd4fe66.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://demo/textures/untexture.png"
dest_files=["res://.godot/imported/untexture.png-e9b4c6dd107bfceece0daf5f5dd4fe66.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0