2024-02-07 22:04:19 +00:00
|
|
|
class_name ProxyController
|
|
|
|
extends Controller
|
|
|
|
|
2024-02-15 17:06:44 +00:00
|
|
|
@export var interpolation_speed: float = 10.0
|
2024-02-07 22:04:19 +00:00
|
|
|
|
2024-02-15 17:06:44 +00:00
|
|
|
var player: Player
|
2024-02-07 22:04:19 +00:00
|
|
|
var server_position: Vector3
|
|
|
|
|
|
|
|
func _init(new_player: Player):
|
|
|
|
player = new_player
|
2024-02-15 15:28:27 +00:00
|
|
|
name = "Controller"
|
2024-02-07 22:04:19 +00:00
|
|
|
|
|
|
|
func _ready():
|
|
|
|
server_position = player.position
|
|
|
|
|
2024-02-15 17:06:44 +00:00
|
|
|
func _process(delta: float):
|
|
|
|
var time := interpolation_speed * delta
|
|
|
|
player.position.x = lerpf(player.position.x, server_position.x, time)
|
|
|
|
player.position.z = lerpf(player.position.z, server_position.z, time)
|