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