It's due to the number of slide operations applied by move_and_slide*. By default upon colliding with a surface, the function will try to re-apply the remaining velocity of the body up to 4 times, to make you smoothly move along slopes or curved surfaces. When landing on a slope though, it causes you to move a bit.
You can update your call to move_and_slide_with_snap like so:
move_and_slide_with_snap(_velocity, snap, FLOOR_NORMAL, true, 3 if is_on_floor() else 1, PI/3)
The fifth argument is the number of slides (move, collide, and project the velocity along the surface) to apply. 3 on the floor, and 1 in the air. With these values, upon landing, the character will stop.
The 6th argument is the max angle of the slope.
Ah, makes sense! Thank you for the explanation, it's very helpful :)
Thought I would post it here since it's related to the OP's topic.
I found that when I use
3 if is_on_floor() else 1
and jump towards the wall while keeping the direction keys pressed down my character clings to the wall and very slowly slides down.
But when I changed it back to 4, it's good again, but then the slight movement is back. Any thoughts?
It makes sense, I hadn't tested walls. The code should take walls into account and have more slides there:
3 if is_on_floor() or is_on_wall() else 1
Thanks, Nathan, it works!
Glad it helped!