move player rotation to _physics_process

This commit is contained in:
Teatov 2025-03-04 20:31:05 +10:00
parent 889a8e6857
commit 08bca13427

View File

@ -25,7 +25,6 @@ func _ready() -> void:
func _process(_delta: float) -> void:
call_deferred("_aiming")
_process_respawning()
var aim_pos := global_position + aiming.aim_offset
Debugger.marker("aim", aim_pos + Vector3.UP)
@ -33,14 +32,16 @@ func _process(_delta: float) -> void:
func _physics_process(delta: float) -> void:
if not is_multiplayer_authority():
return
var can_move := not attack.is_hitting()
velocity = movement.movement(velocity, delta, is_on_floor(), can_move)
move_and_slide()
if not attack.is_hitting() and aiming.aim_offset.length() > 0:
look_at(global_position + aiming.aim_offset, Vector3.UP, true)
_process_respawning()
func _unhandled_input(event: InputEvent) -> void:
var mode := Inputer.get_event_mode(event)
@ -77,13 +78,9 @@ func _aiming() -> void:
if get_viewport().get_visible_rect().has_point(mouse_pos):
aiming.mouse_aiming(mouse_pos, global_position, is_on_floor())
if attack.is_hitting():
return
if aiming.aim_offset.length() > 0:
look_at(global_position + aiming.aim_offset, Vector3.UP, true)
func _process_respawning() -> void:
if global_position.y < _respawn_height:
global_position = _respawn_point
velocity = Vector3.ZERO
reset_physics_interpolation()