my 3D character cannot flip to one side

Godot Version

4.2.2

Question

How to flip 3D character to all sides (my character flips only to 3 instead of 4) ? please, help me

Code

extends CharacterBody3D

@export var anim_player: AnimationPlayer
@export var og_skin: ArrayMesh
@export var black: Material
@export var gravity: float = ProjectSettings.get_setting(“physics/3d/default_gravity”)
@export var run_speed: float = 3
@export var jump_speed: float = 6.0
@export var rotation_speed: float = 5
var can_double_jump: bool = true

func _physics_process(delta):
handle_input()
apply_gravity(delta)
move_and_slide()

func handle_input():
var input = Input.get_vector(“player_left”, “player_right”, “player_forward”, “player_back”)

velocity.x = input.x * run_speed
velocity.z = input.y * run_speed

if is_on_floor():
	if input.length() > 0:
		play_animation("run")
		update_character_flip(input)
	else:
		play_animation("stance")

	if Input.is_action_just_pressed("player_a"):
		jump()

elif can_double_jump and Input.is_action_just_pressed("player_a"):
	jump()

func apply_gravity(delta):
velocity.y -= gravity * delta

func play_animation(animation_name: String):
if anim_player.has_animation(animation_name):
anim_player.play(animation_name)

func jump():
velocity.y = jump_speed
play_animation(“jump_air”)
if can_double_jump == true:
can_double_jump = false
can_double_jump = is_on_floor()

#problem in update_character_flip

func update_character_flip(input: Vector2):
if input.x != 0 or input.y != 0:
var direction = Vector3(input.x, 0, input.y).normalized()

	if direction.length() > 0:
		var target_rotation = direction.angle_to(Vector3.BACK)
		rotation.y = lerp_angle(rotation.y, target_rotation, rotation_speed * get_process_delta_time())