diff --git a/godot/scenes/player/server_node.gd b/godot/scenes/player/server_node.gd index b432a31..dccc0ed 100644 --- a/godot/scenes/player/server_node.gd +++ b/godot/scenes/player/server_node.gd @@ -55,14 +55,14 @@ func _physics_process(delta: float) -> void: else: shared_node.velocity.x = move_toward(shared_node.velocity.x, 0, consts.DEFAULT_CHARACTER_SPEED) shared_node.velocity.z = move_toward(shared_node.velocity.z, 0, consts.DEFAULT_CHARACTER_SPEED) - if multiplayer.is_server(): - update_position.rpc(shared_node.global_position) shared_node.move_and_slide() + @rpc("authority", "call_remote", "unreliable_ordered") func update_position(real_position: Vector3): - shared_node.global_position = lerp(shared_node.global_position, real_position, 1.0) + if not multiplayer.is_server(): + shared_node.global_position = lerp(shared_node.global_position, real_position, 1.0) @rpc("any_peer", "call_local", "unreliable") func jump(): @@ -89,6 +89,7 @@ func set_rotation_y(y: float): func _on_reconciliation_timer_timeout() -> void: if multiplayer.is_server(): _veryfy_position_and_rotation.rpc_id(owner_id) + update_position.rpc(shared_node.global_position) $ReconciliationTimer.start() @rpc("any_peer", "call_local", "reliable")