Controls inverted

hello! there is code, and when i’m starting run it - my controls are inverted, for example if i’ll press w - character moves back, when i’m pressing left, character moves right and so on

extends CharacterBody3D

const SPEED = 2.0
const JUMP_VELOCITY = 4.5
var sens = 0.5
var sens2=0.5
@onready var camera = $camera
@onready var animation_player = $visuals/mixamo_base/AnimationPlayer
@onready var visuals = $visuals

# Get the gravity from the project settings to be synced with RigidBody nodes.
var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")

func _ready():
	Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
func _input(event):
	if event is InputEventMouseMotion:

func _physics_process(delta):
	# Add the gravity.
	if not is_on_floor():
		velocity.y -= gravity * delta

	# Handle jump.
	if Input.is_action_just_pressed("ui_accept") and is_on_floor():
		velocity.y = JUMP_VELOCITY

	# Get the input direction and handle the movement/deceleration.
	# As good practice, you should replace UI actions with custom gameplay actions.
	var input_dir = Input.get_vector("a", "d", "w", "s")
	var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
	if direction:
		if animation_player.current_animation != "walking":"walking")
		visuals.look_at(position + direction)
		velocity.x = direction.x * SPEED
		velocity.z = direction.z * SPEED
		if animation_player.current_animation != "idle":"idle")
		velocity.x = move_toward(velocity.x, 0, SPEED)
		velocity.z = move_toward(velocity.z, 0, SPEED)


help me please, thank you

You can flip the input_dir pretty easily, either change the actions or make it negative.

The model is probably facing “model front” so your look_at needs to account for that, the third optional parameter is a true/false that will flip them around

visuals.look_at(position + direction, Vector3.UP, true)