Ship mostly works #10

Merged
chrisbell merged 60 commits from feature/ship-syncing into develop 2024-12-29 04:35:51 +00:00
Showing only changes of commit 8e3027715a - Show all commits

View File

@ -16,7 +16,8 @@ var current_level
var uuid: String = ""
var old_global_trans_cache: Transform3D
var old_global_rotation_cache: Vector3
var old_global_position_cache: Vector3
@export_range(0.01, 1.0, 0.01) var base_turn_speed: float = 0.35
@export var max_turn_speed: float = 0.5
@ -41,7 +42,7 @@ func _ready():
func _physics_process(_delta):
if !piloting_player.is_network_authority: return
if piloting_player != null and !piloting_player.is_network_authority: return
if ship_is_piloted:
var turn_speed = base_turn_speed / max(mass, 1)
var lift_speed = base_lift_speed / max(mass, 1)
@ -74,9 +75,13 @@ func _physics_process(_delta):
global_rotation.x = lerpf(global_rotation.x, 0, 0.1)
global_rotation.z = lerpf(global_rotation.z, 0, 0.1)
if old_global_trans_cache != global_transform:
NetworkManager.sync_property(uuid, "global_transform", global_transform)
old_global_trans_cache = global_transform
if old_global_position_cache != global_position:
NetworkManager.sync_property(uuid, "global_position", global_position)
old_global_position_cache = global_position
if old_global_rotation_cache != global_rotation:
NetworkManager.sync_property(uuid, "global_rotation", global_rotation)
old_global_rotation_cache = global_rotation
func _on_area_3d_body_entered(body: Node3D) -> void: