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 e43e0cc890 - Show all commits

View File

@ -127,15 +127,15 @@ func _sync_piloting_state():
func _send_ship_sync():
# if piloting_player == null or !piloting_player.is_network_authority:
var sync_buffer: float = 4
if old_global_position_cache.distance_squared_to(global_position) > sync_buffer:
NetworkManager.sync_property(network_uuid, "global_position", global_position)
old_global_position_cache = global_position
if old_global_rotation_cache.distance_squared_to(global_rotation) > sync_buffer:
NetworkManager.sync_property(network_uuid, "global_rotation", global_rotation)
old_global_rotation_cache = global_rotation
if piloting_player != null && !piloting_player.is_network_authority:
var sync_buffer: float = 2
if old_global_position_cache.distance_squared_to(global_position) > sync_buffer:
NetworkManager.sync_property(network_uuid, "global_position", global_position)
old_global_position_cache = global_position
if old_global_rotation_cache.distance_squared_to(global_rotation) > sync_buffer:
NetworkManager.sync_property(network_uuid, "global_rotation", global_rotation)
old_global_rotation_cache = global_rotation
func _handle_ship_sync_position(pos: Vector3):
@ -143,4 +143,4 @@ func _handle_ship_sync_position(pos: Vector3):
func _handle_ship_sync_rotation(rot: Vector3):
lerp(global_rotation, rot, 0.1 * delta_time)
lerp(global_rotation, rot, 0.1 * delta_time)