|
@@ -7,7 +7,8 @@ const PLANE_FORWARD := Vector3.BACK # z increases when moving forward
|
|
|
@export var turn_to_torque: float = 1000.0
|
|
|
@export var move_to_pitch: float = 2000.0
|
|
|
@export var wing_resistance: float = 2500.0
|
|
|
-@export var foil_resistance: float = 250.0
|
|
|
+@export var horizontal_foil_resistance: float = 125.0
|
|
|
+@export var vertical_foil_resistance: float = 250.0
|
|
|
@export var lift: float = 50.0
|
|
|
|
|
|
var target_torque: float = 0.0
|
|
@@ -16,6 +17,7 @@ var target_rotation := Vector3.ZERO
|
|
|
var target_thrust := Vector3.ZERO
|
|
|
|
|
|
@onready var HorizontalFoil : Node3D = $HorizontalFoil
|
|
|
+@onready var VerticalFoil : Node3D = $VerticalFoil
|
|
|
|
|
|
|
|
|
func trigger_thrust(activate: bool) -> void:
|
|
@@ -66,9 +68,21 @@ func _apply_wing_resistance() -> void:
|
|
|
|
|
|
|
|
|
func _apply_foil_resistance() -> void:
|
|
|
+ _apply_horizontal_foil_resistance()
|
|
|
+ _apply_vertical_foil_resistance()
|
|
|
+
|
|
|
+
|
|
|
+func _apply_horizontal_foil_resistance() -> void:
|
|
|
var foil_position : Vector3 = HorizontalFoil.get_position()
|
|
|
+ var vertical_speed = linear_velocity.dot(transform.basis * Vector3.UP)
|
|
|
+ var local_foil_force = Vector3.UP * -horizontal_foil_resistance * vertical_speed
|
|
|
+ apply_force(local_foil_force, foil_position)
|
|
|
+
|
|
|
+
|
|
|
+func _apply_vertical_foil_resistance() -> void:
|
|
|
+ var foil_position : Vector3 = VerticalFoil.get_position()
|
|
|
var horizontal_speed = linear_velocity.dot(transform.basis * Vector3.RIGHT)
|
|
|
- var local_foil_force = Vector3.RIGHT * -foil_resistance * horizontal_speed
|
|
|
+ var local_foil_force = Vector3.RIGHT * -vertical_foil_resistance * horizontal_speed
|
|
|
apply_force(local_foil_force, foil_position)
|
|
|
|
|
|
|