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 func _ready(): server_position = player.position func _process(_delta): var move := server_position - player.position move.y = 0.0 if move.length_squared() < 0.01: player.set_direction(Vector3.ZERO) return var direction := Vector3(move.x, 0, move.z).normalized() player.set_direction(direction)