- Edited
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?