19 lines
490 B
GDScript3
Raw Normal View History

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
2024-02-16 11:51:05 +00:00
player.position.x = Math.dampf(player.position.x, server_position.x, time)
player.position.z = Math.dampf(player.position.z, server_position.z, time)