Functional prototype

This commit is contained in:
Gary Steven Keough 2025-02-02 23:55:33 -05:00
parent 1eb408b1c8
commit 7b9a0ea032
15 changed files with 9341 additions and 56 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c7ldlo5qe26tx"
path="res://.godot/imported/drone_screenshot.png-e86d5d2524a7247bf3d2633f1bf7e6ba.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/textures/drone_screenshot.png"
dest_files=["res://.godot/imported/drone_screenshot.png-e86d5d2524a7247bf3d2633f1bf7e6ba.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
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=1

Binary file not shown.

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b3ecco3iykmlc"
path.bptc="res://.godot/imported/overcast_soil_puresky_4k.hdr-61eab1e0a1143f67442f08d2f25dc8f4.bptc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/textures/overcast_soil_puresky_4k.hdr"
dest_files=["res://.godot/imported/overcast_soil_puresky_4k.hdr-61eab1e0a1143f67442f08d2f25dc8f4.bptc.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

View File

@ -10,10 +10,9 @@ extends RigidBody3D
@export var armed: bool = false
@export var can_flip: bool = false
@export var throttle_speed: float = 0.0
@export var rotation_speed: float = 0.05 # Adjust as needed
@export var acceleration: float = 0.5 # Adjust as needed
@export var max_speed: float = 1.0 # Adjust as needed
@export var max_rotation_speed: float = 5.0 # Adjust as needed
@export var rotation_speed: float = 0.5
@export var max_speed: float = 100.0
@export var max_rotation_speed: float = 15.0
@export var camera_tilt_angle: float = 0.0
@export_category("Node References")
@export var camera: Camera3D
@ -21,6 +20,7 @@ extends RigidBody3D
@export var flip_over_detection_ray: RayCast3D
@export var flip_over_timer: Timer
@export var input_suggestion_label: Label
@export var reset_point: Marker3D
var animation_initalized: bool = false
var using_joy_controller: bool = true
@ -40,15 +40,13 @@ func handle_throttle(throttle_input: float):
if throttle_input > 0:
throttle_speed = throttle_input * 100
apply_central_force(global_transform.basis.y * throttle_speed)
elif throttle_input <= 0.05: # Adjust this value if needed
apply_central_force(global_transform.basis.y * 1) # Minimum thrust
# Speed scale adjusted for animation
anim_player.speed_scale = throttle_input * 4
anim_player.speed_scale = clampf(anim_player.speed_scale, 1.0, 4.0)
linear_velocity.x = clampf(linear_velocity.x, -max_speed, max_speed)
linear_velocity.y = clampf(linear_velocity.y, -100.0, max_speed) # Keep vertical clamping
linear_velocity.y = clampf(linear_velocity.y, -max_speed, max_speed)
linear_velocity.z = clampf(linear_velocity.z, -max_speed, max_speed)
@ -89,7 +87,7 @@ func _handle_drone_flipping():
can_flip = false
func _physics_process(_delta): # Still needed for other physics
func _physics_process(_delta): # Still needed for other physics
if flip_over_detection_ray.is_colliding() and flip_over_detection_ray.get_collider().is_in_group("Ground"):
_start_flip_over_timer()
@ -97,14 +95,22 @@ func _physics_process(_delta): # Still needed for other physics
_handle_drone_flipping()
func _input(event):
if Input.is_action_just_pressed("reset_drone"):
global_position = reset_point.global_position
global_rotation = Vector3.ZERO
linear_velocity = Vector3.ZERO
angular_velocity = Vector3.ZERO
func _integrate_forces(state): # Use _integrate_forces for RigidBody3D control
if armed: # Only apply controls when armed
if armed and GameManager.game_started: # Only apply controls when armed and when the game has started
var yaw_input = Input.get_axis("yaw_right", "yaw_left")
var roll_input = Input.get_axis("roll_right", "roll_left")
var pitch_input = Input.get_axis("pitch_backward", "pitch_forward")
var throttle_input = Input.get_axis("throttle_down", "throttle_up")
handle_throttle(throttle_input) # Throttle still handled here
handle_throttle(throttle_input) # Throttle handled here
if yaw_input != 0:
rotate_object_local(Vector3.UP, yaw_input * rotation_speed) # Y axis rotation
@ -113,7 +119,7 @@ func _integrate_forces(state): # Use _integrate_forces for RigidBody3D control
if pitch_input != 0:
rotate_object_local(Vector3.RIGHT, pitch_input * rotation_speed) # X axis rotation
# Damping (Important! Still needed):
# Damping
if yaw_input == 0:
state.angular_velocity.y = lerp(state.angular_velocity.y, 0.0, 0.05)
if roll_input == 0:
@ -121,7 +127,7 @@ func _integrate_forces(state): # Use _integrate_forces for RigidBody3D control
if pitch_input == 0:
state.angular_velocity.x = lerp(state.angular_velocity.x, 0.0, 0.05)
# Clamp the angular velocity (optional, but good practice):
# Clamp the angular velocity
state.angular_velocity.y = clampf(state.angular_velocity.y, -max_rotation_speed, max_rotation_speed)
state.angular_velocity.z = clampf(state.angular_velocity.z, -max_rotation_speed, max_rotation_speed)
state.angular_velocity.x = clampf(state.angular_velocity.x, -max_rotation_speed, max_rotation_speed)

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=103 format=4 uid="uid://dwvmna8qc0vb4"]
[gd_scene load_steps=104 format=4 uid="uid://dwvmna8qc0vb4"]
[ext_resource type="Script" path="res://core/drone/drone.gd" id="1_de83i"]
[ext_resource type="Material" uid="uid://d0gkxc5fuh354" path="res://core/resources/materials/black_carbon_fiber.tres" id="2_phv8m"]
@ -11,6 +11,7 @@
[ext_resource type="Script" path="res://core/scripts/camera_3d.gd" id="9_8eblv"]
[ext_resource type="Shader" path="res://core/resources/shaders/vhs.gdshader" id="9_66bpw"]
[ext_resource type="Texture2D" uid="uid://bv7klk2tmhya2" path="res://assets/textures/rgba-noise-medium.png" id="10_ylv8e"]
[ext_resource type="PackedScene" uid="uid://c6w6axh4l4w8d" path="res://core/tools/fps_label.tscn" id="12_u7iaa"]
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_kpx62"]
bounce = 0.1
@ -1366,3 +1367,18 @@ theme_override_constants/margin_bottom = 40
visible = false
layout_mode = 2
text = "press A to flip drone"
[node name="HBoxContainer" type="HBoxContainer" parent="VisualComponets/CameraPivot/Camera3D/CanvasLayer/HUD"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
alignment = 2
[node name="VBoxContainer" type="VBoxContainer" parent="VisualComponets/CameraPivot/Camera3D/CanvasLayer/HUD/HBoxContainer"]
layout_mode = 2
[node name="MarginContainer" parent="VisualComponets/CameraPivot/Camera3D/CanvasLayer/HUD/HBoxContainer/VBoxContainer" instance=ExtResource("12_u7iaa")]
layout_mode = 2

File diff suppressed because one or more lines are too long

View File

@ -1,16 +1,19 @@
[gd_scene load_steps=9 format=3 uid="uid://deah8x3tnm045"]
[gd_scene load_steps=12 format=3 uid="uid://deah8x3tnm045"]
[ext_resource type="PackedScene" uid="uid://bfhw7682gnh22" path="res://core/levels/test_level.tscn" id="1_ylfl7"]
[ext_resource type="Texture2D" uid="uid://b3ecco3iykmlc" path="res://assets/textures/overcast_soil_puresky_4k.hdr" id="1_4mr0e"]
[ext_resource type="PackedScene" uid="uid://dwvmna8qc0vb4" path="res://core/drone/drone.tscn" id="2_orkyq"]
[ext_resource type="Script" path="res://core/scripts/camera_3d.gd" id="3_sec6q"]
[ext_resource type="Script" path="res://core/scripts/los_view.gd" id="3_supaf"]
[ext_resource type="Texture2D" uid="uid://c7ldlo5qe26tx" path="res://assets/textures/drone_screenshot.png" id="4_0ftx7"]
[ext_resource type="Script" path="res://core/scripts/main_menu.gd" id="4_bknjq"]
[ext_resource type="PackedScene" uid="uid://ctnwdiavrytwe" path="res://core/levels/contruction_site.tscn" id="4_oqdxa"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_rtxf7"]
sky_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
ground_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
[sub_resource type="PanoramaSkyMaterial" id="PanoramaSkyMaterial_qks7v"]
panorama = ExtResource("1_4mr0e")
energy_multiplier = 0.5
[sub_resource type="Sky" id="Sky_dsv6k"]
sky_material = SubResource("ProceduralSkyMaterial_rtxf7")
sky_material = SubResource("PanoramaSkyMaterial_qks7v")
[sub_resource type="Environment" id="Environment_ruppb"]
background_mode = 2
@ -28,21 +31,28 @@ point_count = 4
[node name="Main" type="Node3D"]
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(-0.866023, -0.433016, 0.250001, 0, 0.499998, 0.866027, -0.500003, 0.749999, -0.43301, 0, 0, 0)
transform = Transform3D(-0.924804, -0.329475, 0.190221, 1.47562e-08, 0.499998, 0.866027, -0.380444, 0.800905, -0.4624, 0, 0, 0)
light_color = Color(0.780392, 0.772549, 0.768627, 1)
light_energy = 0.5
shadow_enabled = true
shadow_bias = 0.0
shadow_blur = 4.542
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_ruppb")
[node name="TestLevel" parent="." instance=ExtResource("1_ylfl7")]
[node name="Drone" parent="." instance=ExtResource("2_orkyq")]
[node name="ResetPoint" type="Marker3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.017014, 0)
[node name="LOSView" type="Node3D" parent="."]
[node name="Drone" parent="ResetPoint" node_paths=PackedStringArray("reset_point") instance=ExtResource("2_orkyq")]
reset_point = NodePath("..")
[node name="LOSView" type="Node3D" parent="." node_paths=PackedStringArray("drone", "child_camera")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.23896, 0.638642, -1.134)
script = ExtResource("3_supaf")
zoom_curve = SubResource("Curve_nxnkk")
drone = NodePath("../ResetPoint/Drone")
child_camera = NodePath("LOSCamera3D")
[node name="LOSCamera3D" type="Camera3D" parent="LOSView"]
near = 0.002
@ -51,21 +61,60 @@ script = ExtResource("3_sec6q")
[node name="CanvasLayer" type="CanvasLayer" parent="."]
layer = 2
visible = false
[node name="MainMenu" type="Control" parent="CanvasLayer"]
[node name="MainMenu" type="Control" parent="CanvasLayer" node_paths=PackedStringArray("start_button", "quit_button")]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("4_bknjq")
start_button = NodePath("HBoxContainer/VBoxContainer/MarginContainer/VBoxContainer/StartButton")
quit_button = NodePath("HBoxContainer/VBoxContainer/MarginContainer/VBoxContainer/QuitButton")
[node name="ColorRect" type="ColorRect" parent="CanvasLayer/MainMenu"]
[node name="TextureRect" type="TextureRect" parent="CanvasLayer/MainMenu"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0.351563, 0.351563, 0.351563, 1)
texture = ExtResource("4_0ftx7")
expand_mode = 1
[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer/MainMenu"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
alignment = 2
[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/MainMenu/HBoxContainer"]
layout_mode = 2
alignment = 1
[node name="MarginContainer" type="MarginContainer" parent="CanvasLayer/MainMenu/HBoxContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/margin_right = 150
[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/MainMenu/HBoxContainer/VBoxContainer/MarginContainer"]
layout_mode = 2
theme_override_constants/separation = 20
alignment = 1
[node name="StartButton" type="Button" parent="CanvasLayer/MainMenu/HBoxContainer/VBoxContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
focus_neighbor_bottom = NodePath("../QuitButton")
theme_override_font_sizes/font_size = 50
text = "START"
[node name="QuitButton" type="Button" parent="CanvasLayer/MainMenu/HBoxContainer/VBoxContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
focus_neighbor_top = NodePath("../StartButton")
theme_override_font_sizes/font_size = 50
text = "QUIT"
[node name="TestLevel" parent="." instance=ExtResource("4_oqdxa")]

View File

@ -3,6 +3,7 @@ extends Node3D
@export var camera_array: Array[Camera3D] = []
@export var current_camera: int = 0
@export var game_started: bool = false
func _process(delta):
@ -14,3 +15,7 @@ func _process(delta):
current_camera = 0
camera_array[current_camera].make_current()
print(current_camera)
func start_game():
game_started = true

View File

@ -1,14 +1,14 @@
extends Node3D
@export var zoom_curve: Curve
@export var drone: RigidBody3D
@export var child_camera: Camera3D
var child_camera: Camera3D
var drone: RigidBody3D
var dist_to_drone: float = 0.0
func _ready():
child_camera = get_child(0)
drone = get_parent().get_node("Drone")
func _physics_process(delta):

19
core/scripts/main_menu.gd Normal file
View File

@ -0,0 +1,19 @@
extends Control
@export var start_button: Button
@export var quit_button: Button
func _ready():
start_button.pressed.connect(_on_start_button_pressed)
quit_button.pressed.connect(_on_quit_button_pressed)
start_button.grab_focus()
func _on_start_button_pressed():
hide()
GameManager.start_game()
func _on_quit_button_pressed():
get_tree().quit()

5
core/tools/fps_label.gd Normal file
View File

@ -0,0 +1,5 @@
extends Label
func _process(delta):
text = str(Engine.get_frames_per_second()) + " FPS"

21
core/tools/fps_label.tscn Normal file
View File

@ -0,0 +1,21 @@
[gd_scene load_steps=2 format=3 uid="uid://c6w6axh4l4w8d"]
[ext_resource type="Script" path="res://core/tools/fps_label.gd" id="1_i0we7"]
[node name="MarginContainer" type="MarginContainer"]
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -69.0
offset_bottom = 40.0
grow_horizontal = 0
theme_override_constants/margin_top = 10
theme_override_constants/margin_right = 20
[node name="FPSLabel" type="Label" parent="."]
layout_mode = 2
theme_override_font_sizes/font_size = 20
text = "120 fps"
horizontal_alignment = 1
vertical_alignment = 1
script = ExtResource("1_i0we7")

View File

@ -19,8 +19,28 @@ config/icon="res://icon.svg"
GameManager="*res://core/scripts/GameManager.gd"
[display]
window/size/mode=4
window/stretch/mode="canvas_items"
window/vsync/vsync_mode=0
[input]
ui_accept={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194309,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194310,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":true,"script":null)
]
}
ui_cancel={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194305,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":1,"pressure":0.0,"pressed":true,"script":null)
]
}
arm={
"deadzone": 0.5,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":2,"pressure":0.0,"pressed":true,"script":null)
@ -76,6 +96,11 @@ change_camera_view={
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":3,"pressure":0.0,"pressed":true,"script":null)
]
}
reset_drone={
"deadzone": 0.5,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":4,"pressure":0.0,"pressed":true,"script":null)
]
}
[layer_names]