move to apply_input_velocity on the subject

This commit is contained in:
2025-02-23 18:25:57 +09:00
parent ca63d4594c
commit 151a757e3e
13 changed files with 142 additions and 62 deletions
+9
View File
@@ -13,7 +13,16 @@ func _ready() -> void:
set_physics_process(false)
func _physics_process(_delta: float) -> void:
if get_multiplayer_authority() != multiplayer.get_unique_id(): return
var directional_input := Input.get_vector("move_right", "move_left", "move_forward", "move_back")
var camera_adjusted: Vector3 = (directional_input.x * _camera_pivot.global_basis.z) + (directional_input.y * _camera_pivot.global_basis.x)
direction = Vector2(camera_adjusted.x, camera_adjusted.z).rotated(PI / 2.0).normalized()
walk = Input.is_action_pressed("walk")
func _input(_event: InputEvent) -> void:
if get_multiplayer_authority() != multiplayer.get_unique_id(): return
if Input.get_mouse_mode() != Input.MOUSE_MODE_CAPTURED: return
primary_interact = Input.is_action_pressed("primary_interact")
secondary_interact = Input.is_action_pressed("secondary_interact")