move aiming processing to physics process to fix jitter

This commit is contained in:
2025-07-27 05:10:58 +10:00
parent f36113d64c
commit aef30cbd88
6 changed files with 131 additions and 124 deletions

View File

@@ -14,7 +14,7 @@ func _ready() -> void:
Input.mouse_mode = Input.MOUSE_MODE_HIDDEN
func _process(delta: float) -> void:
func _process(_delta: float) -> void:
if not Referencer.players or not Referencer.main_camera:
var mouse_pos := get_viewport().get_mouse_position()
_single_cursor.position = mouse_pos - _single_cursor.size / 2
@@ -22,6 +22,8 @@ func _process(delta: float) -> void:
return
_single_cursor.visible = false
func _physics_process(delta: float) -> void:
call_deferred("_handle_cursors", delta)
@@ -87,6 +89,10 @@ func _handle_cursor(player_index: int, delta: float) -> void:
)
cursor.base.modulate = player.cursor_color
if player.input_mode_is(Inputer.Mode.KB_MOUSE):
cursor.base.position = (
get_viewport().get_mouse_position() - cursor.base.size / 2
)
class PlayerCursor: