Camera2s artifacts when moving the player

Godot Version

v4.3.stable.official [77dcf97d8]

Hi, I’m creating a top down pixelart game, I created a sprite for the character with the various movements and after creating the animation tree everything seemed to work with a fixed camera. As soon as I created a level and set Camera2D as the player’s child, strange artifacts appeared that distorted the player.
camera_bug
camera_bug2
this is what the sprite should look like
image_2024-09-21_125108649
camera_ok
Here is the sprite file
Player_sprite
the player code:

extends CharacterBody2D

@export var speed = 100
@export var accel = 10

func _physics_process(_delta):
	var direction: Vector2 = Input.get_vector("Left", "Right", "Up", "Down")
	
	velocity.x = move_toward(velocity.x, speed * direction.x, accel)
	velocity.y = move_toward(velocity.y, speed * direction.y, accel)
	
	if velocity == Vector2.ZERO:
		$AnimationTree.get("parameters/playback").travel("Idle")
	else:
		$AnimationTree.get("parameters/playback").travel("Walk")
		$AnimationTree.set("parameters/Idle/blend_position", velocity)
		$AnimationTree.set("parameters/Walk/blend_position", velocity)
		move_and_slide()
	
func _process(_delta: float) -> void:
	pass

I looked for various solutions here on the forum but I didn’t find anything that helped me, I would like to solve this problem before continuing with the game.

i could see two possible problems here. First does this also happen without camera? If yes, then please show your camera2d setup. If no, then there might be something with your animationtree, can you show your walk-blendspace2d setup?

(And just in case, make sure you have texture filter set to “nearest”)

In Project Settings → Display → Window set Scale Mode to “integer”

1 Like

I tried but nothing changes, thanks anyway

I haven’t modified camera2d, except for a zoom of the area, and without the camera sometimes it works, sometimes it doesn’t, as I’m seeing these days, and yes I set the texture filters in nearest.
In the animationtree I have Idle and Walk with connections synchronized both ways, it is connected to start, and I have not connected it to the end, I don’t know if it is a problem.
here’s Walk


It’s in Italian but I don’t think it changes anything

Hmm i guess it has something to do with your zoom and or your screen-size