class_name ProxyController extends Controller ## The character that we're controlling. var player: Player ## The authoritative position on the server. var server_position: Vector3 func _init(new_player: Player): player = new_player name = "Controller" func _ready(): server_position = player.position func _process(_delta): var move := server_position - player.position move.y = 0.0 if move.length_squared() < 0.02: direction_changed.emit(Vector3.ZERO) return var direction := Vector3(move.x, 0, move.z).normalized() direction_changed.emit(direction)