Tweaked the "feel" and map

This commit is contained in:
2025-02-03 22:47:25 -05:00
parent d520c17010
commit b4341a0598
3 changed files with 733 additions and 35 deletions

View File

@@ -7,10 +7,11 @@ extends RigidBody3D
@export_category("Parameters")
@export var flight_modes: Array = ["normal", "acro"]
@export var throttle_curve: Curve
@export var armed: bool = false
@export var can_flip: bool = false
@export var throttle_speed: float = 0.0
@export var rotation_speed: float = 0.15
@export var rotation_speed: float = 0.06
@export var max_speed: float = 20.0
@export var max_rotation_speed: float = 15.0
@export var thrust_factor: float = 1.0
@@ -101,11 +102,13 @@ func _integrate_forces(state):
if using_joy_controller:
if throttle_input > 0:
throttle_speed = throttle_input * 100
apply_central_force(global_transform.basis.y * throttle_speed * thrust_factor)
apply_central_force(global_transform.basis.y * throttle_curve.sample((throttle_speed-1)/99) * thrust_factor)
linear_velocity.x = clampf(linear_velocity.x, -max_speed, max_speed)
linear_velocity.y = clampf(linear_velocity.y, -100.0, max_speed)
linear_velocity.y = clampf(linear_velocity.y, -max_speed*1.5, max_speed)
linear_velocity.z = clampf(linear_velocity.z, -max_speed, max_speed)
apply_central_force(global_transform.basis.y * 1 * thrust_factor) # Base thrust while props are idley spinning
# Speed scale adjusted for animation
anim_player.speed_scale = throttle_input * 4
@@ -120,8 +123,8 @@ func _integrate_forces(state):
# Damping
if yaw_input == 0:
state.angular_velocity.y = lerp(state.angular_velocity.y, 0.0, 0.05)
state.angular_velocity.y = lerp(state.angular_velocity.y, 0.0, 0.1)
if roll_input == 0:
state.angular_velocity.z = lerp(state.angular_velocity.z, 0.0, 0.05)
state.angular_velocity.z = lerp(state.angular_velocity.z, 0.0, 0.1)
if pitch_input == 0:
state.angular_velocity.x = lerp(state.angular_velocity.x, 0.0, 0.05)
state.angular_velocity.x = lerp(state.angular_velocity.x, 0.0, 0.1)

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=104 format=4 uid="uid://dwvmna8qc0vb4"]
[gd_scene load_steps=105 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"]
@@ -16,6 +16,12 @@
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_kpx62"]
bounce = 0.1
[sub_resource type="Curve" id="Curve_x75as"]
max_value = 100.0
bake_resolution = 1
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 100), 235.0, 0.0, 0, 0]
point_count = 2
[sub_resource type="Animation" id="Animation_a4tqt"]
length = 0.001
tracks/0/type = "value"
@@ -1087,11 +1093,12 @@ shader_parameter/noise_texture = ExtResource("10_ylv8e")
[node name="Drone" type="RigidBody3D" node_paths=PackedStringArray("camera", "anim_player", "flip_over_detection_ray", "flip_over_timer", "input_suggestion_label")]
collision_layer = 2
collision_mask = 7
mass = 0.6
physics_material_override = SubResource("PhysicsMaterial_kpx62")
can_sleep = false
continuous_cd = true
script = ExtResource("1_de83i")
throttle_curve = SubResource("Curve_x75as")
thrust_factor = 2.0
camera = NodePath("VisualComponets/CameraPivot/Camera3D")
anim_player = NodePath("AnimationPlayer")
flip_over_detection_ray = NodePath("FlipOverDetectionRay")
@@ -1305,7 +1312,7 @@ skeleton = NodePath("")
surface_material_override/0 = ExtResource("4_ltc6o")
[node name="CameraPivot" type="Node3D" parent="VisualComponets"]
transform = Transform3D(1, 0, 0, 0, 0.965926, 0.258819, 0, -0.258819, 0.965926, 0, 4.87816, 15.4717)
transform = Transform3D(1, 0, 0, 0, 0.866026, 0.5, 0, -0.5, 0.866026, 0, 4.87816, 15.4717)
[node name="camera" type="MeshInstance3D" parent="VisualComponets/CameraPivot"]
transform = Transform3D(2.12178, 0, 0, 0, 2.12178, 0, 0, 0, 1.06089, 0, 0, 0)