I am making a project in which an object follows your cursor as it moves around, but is blocked by physics objects. Currently, the object experiences a large amount of jitter when it collides with a physics object, and I can't figure out how to stop this from happening.
here's a video of it happening

The code for the object is this

extends CharacterBody2D

const SPEED = 20

func _physics_process(delta):
	var direction = get_local_mouse_position()

	velocity = direction * SPEED 

	move_and_slide()

How should I fix this?

Using delta in your direction * speed might help.

    fire7side move_and_slide doesn't need a delta coefficient for velocity, it's move_and_collide that does

      voidsf This guy uses normalized. Maybe you don't need it with mouse position, or maybe move and collide would work better.

      You probably want to normalize the mouse position. If it's too big it will penetrate into the box and cause jitters as it bounces back.