Reorganized file structure
This commit is contained in:
25
client/player/controller/ProxyController.gd
Normal file
25
client/player/controller/ProxyController.gd
Normal file
@ -0,0 +1,25 @@
|
||||
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)
|
Reference in New Issue
Block a user