I have a KinematicBody character with a capsule collider attached to it. I am attempting to slide this character along a surface. The Vector3.slide() function seems to work as you'd expect: with some horizontal movement vector and gravity, sliding across a surface with an upwards-facing normal zeroes out the character's vertical velocity and leaves just a horizontal movement, which one would reasonably expect to enable the player to glide along the surface without any issue; after all, gravity has already been applied and will not be applied again until next fixed process, so it's perfectly horizontal and thus should not be interrupted by a collider beneath the body.
So far so good: the issue is that, after applying the slide to both the extra motion and the character's velocity, and feeding the motion into move(), move() spits out the exact same vector as was given to it; in other words it doesn't move anywhere as it still believes it's colliding with something, and that something is apparently the floor that I was supposed to slide across. The result is that the KinematicBody gets stuck after a short time and refuses to move until you feed it another movement vector, and even that won't work 99 fixed processes out of 100
Modifying the KinematicBody's collision margin to a high number (at least 0.01 afaict) entirely removes the problem, but makes it so that the KinematicBody snaps to the floor when it gets close enough. The lower this number is, the more often the body will stick. Any number higher than the lowest number possible is unworkable since the snapping is very jarring and unnatural.
Oddly the Kinematic Character 3D example works just fine; I even copied over the code from that project into mine just to see if it would work, but it does not and my body still gets stuck.
I've tried doing exactly the same on the KinematicBody2D and that works perfectly fine as well.
Does anyone have experience using KinematicBody? Is there something I'm simply not getting? Is there something about KinematicBody's move() that I need to compensate for, such as just ensuring my player hovers away from colliders by a small bit? Here's the logic I'm working with now (stripped of irrelevant bits):
func _fixed_process(delta):
velocity += desired_motion
velocity.y -= delta * gravity
var motion = move(velocity * delta)
var col_checks = 4
while(is_colliding() and col_checks):
var normal = get_collision_normal()
velocity = normal.slide(velocity)
motion = normal.slide(motion)
motion = move(motion)
col_checks -= 1