21 lines
551 B
GDScript3
Raw Normal View History

2024-01-26 16:14:20 +00:00
class_name ProxyController
2024-01-29 22:16:06 +00:00
extends Controller
2024-01-26 16:14:20 +00:00
2024-01-29 22:16:06 +00:00
## The authoritative position on the server.
2024-01-26 16:14:20 +00:00
var server_position: Vector3
func _ready():
2024-01-29 22:16:06 +00:00
print(character.name, ".old: ", server_position)
2024-01-26 16:14:20 +00:00
server_position = character.position
2024-01-29 22:16:06 +00:00
print(character.name, ".new: ", server_position)
2024-01-26 16:14:20 +00:00
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()