21 lines
551 B
GDScript

class_name ProxyController
extends Controller
## The authoritative position on the server.
var server_position: Vector3
func _ready():
print(character.name, ".old: ", server_position)
server_position = character.position
print(character.name, ".new: ", server_position)
func _process(_delta):
var move := server_position - character.position
move.y = 0.0
if move.length_squared() < 0.01:
character.direction = Vector3.ZERO
return
character.direction = Vector3(move.x, 0, move.z)
character.direction = character.direction.normalized()