From 359e4554badf29dd36f43865a5a6901dfc98ef06 Mon Sep 17 00:00:00 2001 From: Chris Bell Date: Thu, 19 Dec 2024 20:45:24 -0600 Subject: [PATCH] More AI lol --- assets/core/ships/ship_script.gd | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/assets/core/ships/ship_script.gd b/assets/core/ships/ship_script.gd index e0da4c5..2aae6bb 100644 --- a/assets/core/ships/ship_script.gd +++ b/assets/core/ships/ship_script.gd @@ -163,18 +163,18 @@ func _send_ship_sync(): func _handle_ship_sync_position(pos: Vector3): if piloting_player and not piloting_player.is_network_authority: - # Correct prediction with server data - predicted_position = pos - linear_velocity = (pos - global_position) / delta_time + # Correct prediction with server data only if the difference is significant + if (pos - global_position).length() > 0.1: + predicted_position = pos + linear_velocity = (pos - global_position) / delta_time func _handle_ship_sync_rotation(rot: Vector3): if piloting_player and not piloting_player.is_network_authority: - # Correct prediction with server data - predicted_rotation = Quaternion.from_euler(Vector3(rot.x, rot.y, rot.z)) - # Calculate angular velocity based on rotation change + # Correct prediction with server data only if the difference is significant var received_rotation = Quaternion.from_euler(Vector3(rot.x, rot.y, rot.z)) var delta_rot = received_rotation * global_rotation.inverse() - if delta_rot.length() > 0.001: + if delta_rot.length() > 0.1: + predicted_rotation = received_rotation angular_velocity = delta_rot.get_euler() / delta_time # Apply server rotation directly