17 lines
647 B
GDScript
17 lines
647 B
GDScript
extends MultiplayerSynchronizer
|
|
|
|
var move_direction: Vector2
|
|
|
|
func _ready() -> void:
|
|
move_direction = Vector2.ZERO
|
|
|
|
if multiplayer.is_server() or get_multiplayer_authority() != multiplayer.get_unique_id():
|
|
set_process(false)
|
|
set_physics_process(false)
|
|
return
|
|
|
|
func _physics_process(_delta: float) -> void:
|
|
var directional_input := Input.get_vector("move_right", "move_left", "move_forward", "move_back")
|
|
var camera_adjusted: Vector3 = (directional_input.x * %RunnerCameraTarget.global_basis.z) + (directional_input.y * %RunnerCameraTarget.global_basis.x)
|
|
move_direction = Vector2(camera_adjusted.x, camera_adjusted.z).rotated(PI / 2.0)
|